Git错误: failed to push some refs to “..”

命令输入:

git push origin master

出现

! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/Visen123/ShortVideo.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 integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

解决方法:

(1)先重新设置本机git配置:git config --global credential.helper store

(2)输入github账号和密码

(3)最后push代码:git push -u origin master

2.重置git配置的http或https代理的:

http version:

git config --global --unset http.proxy
1
https version:

git config --global --unset https.proxy

(1)移除本地分支:git remote rm origin
(2)添加远程分支:git remote add origin 'https://github.com/***.git'
(3)然后:git pull即可

猜你喜欢

转载自blog.51cto.com/1206995290qq/2335812
今日推荐