【问题解决】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.

解决方法1:(此方法将导致仓库数据统计中的贡献者只有最后一个上传者)

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

直接输入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 地址

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

然后就可以了

相关文章
|
4天前
|
开发工具 git 开发者
|
5天前
|
网络安全 开发工具 数据安全/隐私保护
Win10使用Git克隆项目出现fatal: Authentication failed for异常
Windows 10系统中使用Git克隆项目时出现"fatal: Authentication failed for"异常的解决方法,主要是通过修改凭据管理器中的Git凭据密码来解决因密码过期导致的身份验证失败问题。
14 0
Win10使用Git克隆项目出现fatal: Authentication failed for异常
|
7天前
|
开发工具 Android开发 git
解决Idea报错出现Git is not installed
解决Idea报错出现Git is not installed
19 2
|
7天前
|
网络安全 开发工具 数据安全/隐私保护
Git——报错总结
Git——报错总结
17 1
|
1月前
|
网络安全 开发工具 git
【git】解决git报错:ssh:connect to host github.com port 22: Connection timed out 亲测有效
【git】解决git报错:ssh:connect to host github.com port 22: Connection timed out 亲测有效
161 1
|
2月前
|
Shell 网络安全 开发工具
git实现服务器自动push拉取代码--webhooks
git实现服务器自动push拉取代码--webhooks
175 1
|
2月前
|
开发工具 git
蓝易云 - 解决git clone时出现Failed to connect to 127.0.0.1 port 1573问题
希望这些信息能帮助你解决问题。如果问题仍然存在,可能需要检查你的网络设置或者联系你的网络管理员。
38 3
|
1月前
|
网络安全 开发工具 git
使用git克隆仓库报错:Warning: Permanently added‘github.com’ to the .....(ssh )
所以,你可以安全地忽略这个警告,它不会影响到你使用git克隆仓库。如果你已经成功克隆了仓库,那么一切都在正常工作。如果你在克隆过程中遇到其他问题,那可能需要查看具体的错误信息来解决。
20 0
|
2月前
|
网络安全 开发工具 数据安全/隐私保护
git pull/push每次都需要输入密码问题
git pull/push每次都需要输入密码问题
51 0
|
2月前
|
Linux 开发工具 git
解决 Linux git push 贡献者不同(没有出现绿点)的问题
解决 Linux git push 贡献者不同(没有出现绿点)的问题