Reputation: 38691
My git remote repo looks like this:
$ git remote -v
origin https://github.com/jiangxiaoqiang/dolphin-scripts.git (fetch)
origin https://github.com/jiangxiaoqiang/dolphin-scripts.git (push)
origin https://gitee.com/jiangxiaoqiang/dolphin-scripts.git (push)
now I want fetch from gitee by default, how to change the fetch url to gitee?
Upvotes: 0
Views: 2642
Reputation: 977
As @Jason Phillips says, you have to first do:
git remote remove origin
which will remove the origin remote and the URLs associated with it. Next you do:
git remote add origin https://gitee.com/jiangxiaoqiang/dolphin-scripts.git
which will add a new remote called origin
associated with the gitee
URL.
Now you add another remote (let's call it extra
) which will be used to push to GitHub
git remote add extra https://github.com/jiangxiaoqiang/dolphin-scripts.git
Now you may do a git push extra
to push to GitHub and git fetch origin
or git pull origin
to fetch and pull changes from Gitee
respectively.
Best
Upvotes: 2
Reputation: 344
try
git remote add origin https://gitee.com/jiangxiaoqiang/dolphin-scripts.git --mirror=fetchde here
if you already have origin you may have to clean up the remote names and readd (3 commands):
git remote origin remove
git remote add origin https://gitee.com/jiangxiaoqiang/dolphin-scripts.git
git remote set-url --push origin https://github.com/jiangxiaoqiang/dolphin-scripts.git
Upvotes: 3