2017-01-01 43 views
0

目标:将远程github存储库中的/ var/www/html/wp推入newstart。为什么不能将我的wordpress目录推入远程github存储库?

ssh -T [email protected] 
You've successfully authenticated, but GitHub does not provide shell access. 

ssh和github处于良好状态。

在远程

1.To创建于GitHub的网页命名为newstart新项目。

在当地

2.cd在/ var/WWWW/HTML/WP
3.sudo的git的init
4.git添加*
5.git推起源主
错误:SRC的Refspec主不匹配任何。
错误:未能将某些参考文献推送到“原点”

感谢ffledgling,添加了两个命令。

git commit -m "First commit" 
git remote add origin git+ssh://[email protected]/someone/newstart.git 

git push origin master 
To git+ssh://[email protected]/someone/newstart.git 
! [rejected]  master -> master (fetch first) 
error: failed to push some refs to 'git+ssh://[email protected]/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. 

如何将/ var/www/html/wp现在推送到远程github存储库中?

回答

0
  1. 你没有git的承诺。
  2. 你没告诉git origin的含义。你必须:

    $ git remote add origin remote repository URL 
    

详见说明书here

+0

现在增加了两个命令,出现了新问题。 –

0

1.git推-f起源主 为了解决这个问题:failed to push some refs to...在混帐推命令-f参数。
2.改变须藤的git的init的git的init
为什么要改变须藤的git的initgit的初始化

如果git的是由须藤的git的init建立,将有混帐推-f起源主权限的问题。

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 

如果git的是由git的初始化创建的,所以不会混帐推-f起源主权限的问题。

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 

.git目录的所有权将防止执行混帐推-f起源主

现在干得好。

0
error: failed to push some refs to 'git+ssh://[email protected]/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. 

上述错误说明您目前没有与远程存储库同步。

同步

git pull --rebase 

现在推

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> 
相关问题