error: failed to push some refs to 'https://xxxx.git'

 使用TortoiseGit克隆远程仓库后,无论pull还是push均出现以下错误:

git.exe push --progress "master" master:master

To https://gitee.com/tangzhichao/pot_test.git
! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://gitee.com/tangzhichao/pot_test.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.


git 未能顺利结束 (退出码 1) (1672 ms @ 2019/11/30 11:29:22)

原因:

没有指定远程仓库名,或者指定的远程仓库名不存在!

解决方法:

双击打开git-bash.exe,git-bash.exe在git安装目录的根目录

然后使用cd命令进入刚刚你要操作的git本地库的根目录,如cd E:/git/pot_test,一定要记得把windows的反斜杠改成正斜杠!

输入git remote -v,查看有哪些远程仓库名,

然后,git pull 远程仓库名

操作过程截图:

然后git-bash.exe可以放一边了,可以使用TortoiseGit了,此时,无论pull还是push均出现TortoiseGit均会自动把远端带上,我们不用动也不要改。

至于为什么刚刚clone的远程仓库,TortoiseGit居然push和pull时却还要手动填写远程仓库,我学艺不精暂时不知道原因,以前一直都可以克隆仓库后直接pull和push,我也是头一次遇到这类问题。

完。

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
根据引用\[1\]的错误信息,你在执行`git push -u origin master`命令时遇到了错误。错误提示是`! \[rejected\] master -> master (fetch first)`,这通常是由于远程分支包含了本地分支中不存在的提交导致的。这是多人协作开发过程中常见的问题。 根据引用\[2\]的正确解决办法,你可以先与远程仓库建立连接,使用命令`git remote add origin https://gitee.com/xxx/xxx.git`。这样就能将远程仓库克隆到本地。 另外,根据引用\[3\]的解决方法2,你可以先将远程分支上的所有文件下载到本地,使用命令`git clone https://gitee.com/xxx/xxx.git`。然后将要上传的文件放入刚刚下载的文件夹中,再使用命令`git add`、`git commit`和`git push`来上传文件。 综上所述,你可以尝试先与远程仓库建立连接,然后将远程分支上的文件下载到本地,最后将要上传的文件放入文件夹中并执行相应的git命令来解决问题。 #### 引用[.reference_title] - *1* *3* [Git Bash中出现:error: failed to push some refs to ‘https://gitee.com/xxx/xxx.git‘错误的解决方法](https://blog.csdn.net/seven__lover/article/details/122199611)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [git使用git push -u origin master提交远程仓库时报错error: failed to push some refs to ‘...](https://blog.csdn.net/qq_48435252/article/details/131537027)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值