我是靠谱客的博主 美丽板栗,最近开发中收集的这篇文章主要介绍git push 报错 error: failed to push some refs to ‘git@xxx/xx.git‘,觉得挺不错的,现在分享给大家,希望可以做个参考。
概述
报错原因
git在push时报error: failed to push some refs to 'git@xxx.xx.git’异常,是因为在你要提交之前有人提交了代码,所以产生了冲突造成的,你需要先拉去最新的代码,之后在进行提交即可。
详细的错误信息
[root@xxx pull-image]# git push origin master
Enter passphrase for key '/root/.ssh/id_ed25519':
To git@xxxx/xxx.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@xxx/xx.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 merge 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 pull
git push origin master
[root@xxxx pull-image]# git pull
Enter passphrase for key '/root/.ssh/id_ed25519':
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Total 6 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (6/6), done.
From xxxx
d0f596b..c5164d7 master -> origin/master
Merge made by the 'recursive' strategy.
README.md | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
[root@xxxxpull-image]# git push origin master
Enter passphrase for key '/root/.ssh/id_ed25519':
Counting objects: 11, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (9/9), 1.07 KiB | 0 bytes/s, done.
Total 9 (delta 0), reused 0 (delta 0)
To xxxx/xx.git
c5164d7..81a844c master -> master
最后
以上就是美丽板栗为你收集整理的git push 报错 error: failed to push some refs to ‘git@xxx/xx.git‘的全部内容,希望文章能够帮你解决git push 报错 error: failed to push some refs to ‘git@xxx/xx.git‘所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复