【发布时间】:2017-03-09 15:31:32
【问题描述】:
它是共享的 GIT 存储库。许多人在同一 git 存储库上工作。
这就是为什么我先尝试git pull 进行其他更改然后add, commit & push。
我在本地尝试过以下命令
$ git pull
error: Your local changes to the following files would be overwritten by merge:
File Name
Please commit your changes or stash them before you can merge.
Aborting
提交
$ git commit
no changes added to commit
推送
$ git push
To ssh://git@ab.com:2222/diffusion/SMM/abc.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'ssh://git@ab.com:2222/diffusion/SMM/abc.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.
如何解决这个问题?
【问题讨论】:
-
通过 $git status 检查状态并添加和提交新的和修改过的文件,然后尝试 $git pull origin master
-
@AswathyS 究竟有什么帮助?!
-
@AnkitShah 你在提交之前尝试过添加吗?
-
你是什么
git status?它是否列出了未跟踪的文件? -
@AnkitShah 你不明白哪一部分?您有本地更改。拉动会与这些变化发生冲突。您必须提交它们或还原它们。如果你想提交它们,你必须先添加它们(因此'使用“git add
...”来包含将要提交的内容 ')。
标签: git github ssh git-push git-pull