将Git远程“推送到"更改为默认值 [英] Changing the Git remote 'push to' default
问题描述
我想更改Git默认的远程分支目的地,所以我可以
I want to change the Git default remote branch destination so I could just
git push
代替:
git push upstream
当前将其设置为原始远程,我想将其设置为其他远程.
Currently this is set to the origin remote and I want to set it to a different remote.
我试图删除原始的(克隆自)遥控器
I tried to remove the original (cloned from) remote
git remote rm origin
确实删除了原始遥控器.但是不能解决git push
问题.我仍然得到:
Which did remove the original remote. But doesn't solve the git push
problem. I still get:
致命:没有配置的推送目标.从
中指定URL 命令行或使用...配置远程存储库.
fatal: No configured push destination. Either specify the URL from the
command-line or configure a remote repository using...
我也尝试过玩:
git remote set-url --push myfork origin
和其他选项似乎无效(也许是因为我太早删除了原始远程服务器?)
and other options but none seem to work (maybe because I deleted the origin remote too soon?)
在在此处回答之后,我尝试更改:>
Following the answer here I tried to change:
git config push.default upstream (or matching)
但都不起作用.
推荐答案
我刚刚找到的另一种解决此问题的技术(即使我先删除了origin,这似乎是一个错误)也是直接操作git config:
Another technique I just found for solving this (even if I deleted origin first, what appears to be a mistake) is manipulating git config directly:
git config remote.origin.url url-to-my-other-remote
这篇关于将Git远程“推送到"更改为默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!