[英]Why can't push my wordpress directory into remote github repository?
Target :to push /var/www/html/wp in to newstart in remote github repository. 目标:将/ var / www / html / wp推送到远程github存储库中的newstart中。
ssh -T git@github.com
You've successfully authenticated, but GitHub does not provide shell access.
The ssh and github were in good status. ssh和github处于良好状态。
In remote 在偏远地区
1.To create a new project named newstart
in github web page. 1.在github网页上创建一个名为
newstart
的新项目。
In local 在当地
2.cd /var/wwww/html/wp 2.cd / var / wwww / html / wp
3.sudo git init 3. sudo git初始化
4.git add * 4.git添加*
5.git push origin master 5. git push origin master
error: src refspec master does not match any. 错误:src refspec master不匹配。
error: failed to push some refs to 'origin' 错误:无法将某些参照推送到“原点”
Thank to ffledgling,two commands added. 感谢ffledgling,添加了两个命令。
git commit -m "First commit"
git remote add origin git+ssh://git@github.com/someone/newstart.git
git push origin master
To git+ssh://git@github.com/someone/newstart.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git+ssh://git@github.com/someone/newstart.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
How to push /var/www/html/wp into remote github repository now? 如何现在将/ var / www / html / wp推送到远程github存储库中?
我认为您需要首先在github上创建存储库: https : //help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
1.git push -f origin master To solve the problem: failed to push some refs to...
with -f parameter in git push command. 1. git push -f origin master解决此问题:
failed to push some refs to...
在git push命令中使用-f参数failed to push some refs to...
2. to change sudo git init into git init 2.将sudo git init更改为git init
Why change sudo git init into git init ? 为什么将sudo git init更改为git init ?
If .git was created by sudo git init ,there will be permission problem for git push -f origin master . 如果.git由sudo git init创建,则git push -f origin master将存在权限问题。
ls -al .
total 204
drwxr-xr-x 6 www-data www-data 4096 Jan 1 19:42 .
drwxr-xr-x 5 root root 4096 Dec 12 22:27 ..
drwxr-xr-x 8 root root 4096 Jan 1 21:02 .git
If .git was created by git init ,there will not be permission problem for git push -f origin master . 如果.git由git init创建,则git push -f origin master 不会有权限问题。
ls -al .
total 204
drwxr-xr-x 6 www-data www-data 4096 Jan 1 19:42 .
drwxr-xr-x 5 root root 4096 Dec 12 22:27 ..
drwxr-xr-x 8 debian8 debian8 4096 Jan 1 21:02 .git
The ownership of .git directory will prevent executing git push -f origin master . .git目录的所有权将阻止执行git push -f origin master 。
Well done now. 现在做得好。
error: failed to push some refs to 'git+ssh://git@github.com/someone/newstart.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
The above error says that you currently are not in sync with the remote repository. 上面的错误表明您当前未与远程存储库同步。
Sync 同步
git pull --rebase
Now Push 现在推送
git push origin <branch-name>
If the push still does not work saying that remote does not exists.
如果推送仍然不起作用,则说明该遥控器不存在。 Add it.
添加它。
git remote add origin <path/to/your/remote/repo>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.