> 文章列表 > 【问题解决】Git报错:failed to push some refs to xxxxx

【问题解决】Git报错:failed to push some refs to xxxxx

【问题解决】Git报错:failed to push some refs to xxxxx

Git报错:failed to push some refs to xxxxx

【问题解决】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:(此方法将导致仓库数据统计中的贡献者只有最后一个上传者)

若远程分支上那些提交都不需要了

直接输入git push origin master -f,强行让本地分支覆盖远程分支。:

解决方法2:

2.1.Git Bash here:(如果鼠标右键有Git Bash here的话可以跳过这个部分)

右键显示Git Bash here

window+r

【问题解决】Git报错:failed to push some refs to xxxxx

找到shel的位置

【问题解决】Git报错:failed to push some refs to xxxxx

【问题解决】Git报错:failed to push some refs to xxxxx

左边新建一个项,右边新建一个字符串值

左边的项,修改为Git Bash Here,右边修改为Icon

【问题解决】Git报错:failed to push some refs to xxxxx

【问题解决】Git报错:failed to push some refs to xxxxx

【问题解决】Git报错:failed to push some refs to xxxxx

找到你之前下的git的文章地址,找到git bash.exe文件地址,将这个地址放到Git Bash Here中去

【问题解决】Git报错:failed to push some refs to xxxxx

【问题解决】Git报错:failed to push some refs to xxxxx

在Git Bash Here下建一个项

项的名称改为command

【问题解决】Git报错:failed to push some refs to xxxxx

点击默认

将其中的值改为地址 +空格+“–cd=%v.”【问题解决】Git报错:failed to push some refs to xxxxx

【问题解决】Git报错:failed to push some refs to xxxxx

然后就好啦

【问题解决】Git报错:failed to push some refs to xxxxx

2.2.git clone 地址

【问题解决】Git报错:failed to push some refs to xxxxx

如果出现下面这种情况git init一下

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-dD3W2AEp-1681395928894)(C:\\Users\\小卢\\AppData\\Roaming\\Typora\\typora-user-images\\image-20230413191622253.png)]

2.3三个命令

三个命令

  • git add *
  • git conmit -m ‘“hello”
  • git push origin master

然后就可以了