当前位置:   article > 正文

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

git报错failed 同push some refs to

Git报错:failed to push some refs to xxxxx

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

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

image-20230413164118066

找到shel的位置

image-20230413164318067

image-20230413164421112

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

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

image-20230413164557304

image-20230413164638006

image-20230413164749100

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

image-20230413165105256

image-20230413165139863

在Git Bash Here下建一个项

项的名称改为command

image-20230413175409560

点击默认

将其中的值改为地址 +空格+“–cd=%v.”image-20230413175620961

image-20230413175730576

然后就好啦

image-20230413180122245

2.2.git clone 地址

image-20230413184716935

如果出现下面这种情况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

然后就可以了

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/467841
推荐阅读
相关标签
  

闽ICP备14008679号