Git報錯:failed to push some refs to xxxxx
To https://xxxxxxxxxxxx.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to ‘https://xxxxxxxx.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.git did not exit cleanly (exit code 1)
解決方法1:(此方法將導致倉庫數(shù)據(jù)統(tǒng)計中的貢獻者只有最后一個上傳者)
若遠程分支上那些提交都不需要了
直接輸入git push origin master -f,
強行讓本地分支覆蓋遠程分支。:
解決方法2:
2.1.Git Bash here:(如果鼠標右鍵有Git Bash here的話可以跳過這個部分)
右鍵顯示Git Bash here
window+r
找到shel的位置
左邊新建一個項,右邊新建一個字符串值
左邊的項,修改為Git Bash Here,右邊修改為Icon
找到你之前下的git的文章地址,找到git bash.exe文件地址,將這個地址放到Git Bash Here中去
在Git Bash Here下建一個項
項的名稱改為command
點擊默認
將其中的值改為地址 +空格+“–cd=%v.”
然后就好啦
2.2.git clone 地址
如果出現(xiàn)下面這種情況git init一下
[外鏈圖片轉(zhuǎn)存失敗,源站可能有防盜鏈機制,建議將圖片保存下來直接上傳(img-dD3W2AEp-1681395928894)(C:\Users\小盧\AppData\Roaming\Typora\typora-user-images\image-20230413191622253.png)]
2.3三個命令
三個命令文章來源:http://www.zghlxwxcb.cn/news/detail-413786.html
- **git add ***
- git conmit -m ‘“hello”
- git push origin master
然后就可以了文章來源地址http://www.zghlxwxcb.cn/news/detail-413786.html
到了這里,關(guān)于【問題解決】Git報錯:failed to push some refs to xxxxx的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!