我是靠谱客的博主 美丽板栗,这篇文章主要介绍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’异常,是因为在你要提交之前有人提交了代码,所以产生了冲突造成的,你需要先拉去最新的代码,之后在进行提交即可。

详细的错误信息

复制代码
1
2
3
4
5
6
7
8
9
10
11
[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.

解决方法

先拉去最新的代码,之后在进行提交,命令如下

复制代码
1
2
3
git pull git push origin master
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
[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内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(70)

评论列表共有 0 条评论

立即
投稿
返回
顶部