我正在尝试将文件从我的本地目录提交到在学院git服务器上运行的远程目录

时间:2017-07-16 20:01:49

标签: git

所以最近添加的文件位于C:\ xampp \ htdocs \ eatnow \ doc \ class_diagram \ Final。我试图将此文件夹中的文件推送到远程目录。但我收到此错误消息。

$ git push -u origin master
Enter passphrase for key '/c/Users/Girish/.ssh/id_rsa':
To mygit.th-deg.de:kf01580/EatNow.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@mygit.th-deg.de:kf01580/EatNow.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

在搜索解决方案后,我尝试从远程存储库中取出它,但又一次收到错误消息。

Girish@DESKTOP-AD4L93R MINGW64 /c/xampp/htdocs/eatnow (master)
$ git pull origin doc --allow-unrelated-histories
Enter passphrase for key '/c/Users/Girish/.ssh/id_rsa':
From mygit.th-deg.de:kf01580/EatNow
 * branch            doc        -> FETCH_HEAD
Already up-to-date.

如何纠正这个问题?

1 个答案:

答案 0 :(得分:0)

您必须提取分支master,而不是doc

git checkout master
git pull origin master

修复合并冲突(如果有),再次提交并推送:

git push -u origin master