Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert `git:` urls to `http:` urls

Tags:

git

proxy

People also ask

How do I change my git repository URL?

You can change a Git remote URL using the git remote set-url command. Navigate to the repository whose remote URL you want to change and then execute this command. The set-url command accepts two arguments: the remote name and the new repository URL. Have you changed the name of a remote Git repository?


Here's an example of rewriting the default protocol for GitHub:

git config --global url.https://github.com/.insteadOf git://github.com/

Git documentation for url.<base>.insteadOf:

git config [--global] url.<base>.insteadOf <other_url>

Any URL that starts with this value will be rewritten to start, instead, with <base>. When more than one insteadOf strings match a given URL, the longest match is used.


I don't know how this repo tool uses Git (and if you can configure 'repo' to use http protocol), but you can try to trick it using url.<base>.insteadOf configuration variable (see git-config and git-fetch manpages).

Have you tried to use core.gitProxy to pass through firewall, if it is the problme with using git protocol?


I had this same problem with recursively getting submodules in a git repository. I'm behind a crazy firewall that doesn't allow outgoing connections on the git port. Some of the submodules of the submodules were coded as git://github.com/blah/blah.git. This killed my recursive population of submodules. The workaround is the following:

git config --global url."https://<GITUSERNAME>@".insteadOf git://

This replaces git:// with https://<GITUSERNAME>@ in all submodule repository URLs. You need to replace <GITUSERNAME> with your own git username. Also note that the --global is required; just adding this configuration to the base repository directory doesn't work.


You can verify in ~/.gitconfig if you're overwriting SSH with https://, or vice versa.