[root@localhost newccdeploy]# git push Username for 'https://172.28.17.127': xxxx Password for 'https://xxxxx@172.28.17.127': To https://172.28.17.127/pmc/Operations/newccdeploy.git ! [rejected] main -> main (non-fast-forward) error: failed to push some refs to 'https://172.28.17.127/pmc/Operations/newccdeploy.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. If you want to integrate the remote changes, hint: use 'git pull' before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
是由于本地和远程仓库两者代码文件不同步,因此需要先pull,进行合并然后再进行push
一、先使用pull --rebase,拉取远程仓库文件同步到本地,--rebase参数将当前分支的更改重新应用到获取的最新提交上
[root@localhost newccdeploy]# git pull --rebase origin Username for 'https://172.28.17.127': xxxxx Password for 'https://xxxx@172.28.17.127': Successfully rebased and updated refs/heads/main.
二、再使用push,更新远程仓库
[root@localhost newccdeploy]# git push origin Username for 'https://172.28.17.127': xxxxx Password for 'https://xxxxx@172.28.17.127': Enumerating objects: 17, done. Counting objects: 100% (17/17), done. Delta compression using up to 8 threads Compressing objects: 100% (10/10), done. Writing objects: 100% (11/11), 2.00 KiB | 511.00 KiB/s, done. Total 11 (delta 7), reused 0 (delta 0), pack-reused 0 To https://172.28.17.127/pmc/Operations/newccdeploy.git 0de9b08..f3136c3 main -> main
标签:git,tip,17.127,https,push,报错,newccdeploy,172.28 From: https://www.cnblogs.com/sky-cheng/p/18581167