In git, you can replace some part of the remote repository address (part of the remote addresses) in all repositories using the global config and also this will be given when setting up a specific repository.

We simplify the move from Github <–> Gitlab <–> Bitbucket

If for example you moved from Github to Gitlab and you have locally many projects in which you need to update remote then you can do it globally until you replace remote in all repositories or again No need to use Github.

For example, we have the following remote

origin https://github.com/xorcare/example (fetch)
origin https://github.com/xorcare/example (push)

to replace it with Gitlab in the background and get such a result

origin https://gitlab.com/xorcare/example (fetch)
origin https://gitlab.com/xorcare/example (push)

need to run the following commands:

# replace address when downloading "fetch"
git config --global url. "https://gitlab.com" .insteadOf "https://github.com"
# replace address when sending "push"
git config --global url. "https://gitlab.com" .pushInsteadOf "https://github.com"

Github -> Bitbucket

git config --global url."https://bitbucket.org".insteadOf "https://github.com"
git config --global url."https://bitbucket.org".pushInsteadOf "https://github.com"

Gitlab -> Bitbucket

git config --global url."https://bitbucket.org".insteadOf "https://gitlab.com"
git config --global url."https://bitbucket.org".pushInsteadOf "https://gitlab.com"

Bitbucket -> Github

git config --global url."https://github.com".insteadOf "https://bitbucket.org"
git config --global url."https://github.com".pushInsteadOf "https://bitbucket.org"

Generated with Google translate.