Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
git推送过程中出错_Git_Git Push - Fatal编程技术网

git推送过程中出错

git推送过程中出错,git,git-push,Git,Git Push,我是一个新手,当我进行git push时,我会遇到以下错误: ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'git@github.com:danreardon/mg_app.git' To prevent you from losing history, non-fast-forward updates were rejected Merge the r

我是一个新手,当我进行git push时,我会遇到以下错误:

! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:danreardon/mg_app.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.  See the
'Note about fast-forwards' section of 'git push --help' for details.

有人能帮我解决这个问题吗?

做git从你的源站拉到本地主站,做merge,然后再做push

 git pull origin master
如果需要,您可能需要合并更改


如果远程存储库中的更改尚未在本地master中更新,则您无法推送新的更改。

这将是因为您的本地master版本已过期,请调用git pull并解决冲突。注意只解决冲突

解决冲突的工作与正常情况一样,记住git添加您更新的每个文件,然后执行git提交。只有在解决了所有冲突后才尝试提交。您将获得有关在出现问题时如何中止提交的说明


如果你大部分时间都在一个分支上工作,这将使你的生活更加轻松(即使分支在远程存储库中不存在。

尝试使用
git stash
隐藏本地更改,然后使用
git pull
从远程回购中提取任何更改。然后,执行
git pop
以获取本地更改,然后再次尝试使用
git push
。谢谢!git stash-没有本地更改save git pull-我只在master分支上工作过,它说fatal:“master”似乎不是git存储库fatal:远程端意外挂起git status显示了什么?
git pull--rebase
通常更适合这种情况(避免合并),但我不建议在理解什么是重定基址之前使用它。非常感谢!我感谢您的帮助。现在一切都正常了!