Search code examples
gitgit-remote

git add fetch url to remote


In my repo I have the following situation:

$ git remote -v
origin  http://repoA/_git/libs (fetch)
origin  http://repoB/libs.git (push)
origin  http://repoA/_git/qpp_libs (push)

I want to fetch also from repoB. This is how I wanted to achieve this:

git remote set-url --add origin http://repoB/libs.git

But after running the command above there are still only 3 URLs:

$ git remote -v
origin  http://repoA/_git/libs (fetch)
origin  http://repoB/libs.git (push)
origin  http://repoA/_git/qpp_libs (push)

How do I add aanother fetch URL?


Solution

  • I believe you will need a different remote, as mentioned here. I also think it's not a good working pattern to have it otherwise.

    So having that in mind, as said here, you could try

    git remote add <shortname> <url>