1. 程式人生 > >Git錯誤: failed to push some refs to “..”

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即可