Search code examples
gitgit-remotegit-fetch

how to change remote fetch url in git


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?


Solution

  • 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