How do I pull from a Git repository through an HTTP proxy?
git https proxy
git remove proxy
git no proxy
git protocol proxy
git could not resolve proxy
git zscaler proxy
git bash ssh proxy
Note: while the use-case described is about using submodules within a project, the same applies to a normal
git clone of a repository over HTTP.
I have a project under Git control. I'd like to add a submodule:
git submodule add http://github.com/jscruggs/metric_fu.git vendor/plugins/metric_fu
But I get
... got 1b0313f016d98e556396c91d08127c59722762d0 got 4c42d44a9221209293e5f3eb7e662a1571b09421 got b0d6414e3ca5c2fb4b95b7712c7edbf7d2becac7 error: Unable to find abc07fcf79aebed56497e3894c6c3c06046f913a under http://github.com/jscruggs/metri... Cannot obtain needed commit abc07fcf79aebed56497e3894c6c3c06046f913a while processing commit ee576543b3a0820cc966cc10cc41e6ffb3415658. fatal: Fetch failed. Clone of 'http://github.com/jscruggs/metric_fu.git' into submodule path 'vendor/plugins/metric_fu'
I have my HTTP_PROXY set up:
c:\project> echo %HTTP_PROXY% http://proxy.mycompany:80
I even have a global Git setting for the http proxy:
c:\project> git config --get http.proxy http://proxy.mycompany:80
Has anybody gotten HTTP fetches to consistently work through a proxy? What's really strange is that a few project on GitHub work fine (
awesome_nested_set for example), but others consistently fail (rails for example).
You can also set the HTTP proxy that Git uses in global configuration property
git config --global http.proxy http://proxy.mycompany:80
To authenticate with the proxy:
git config --global http.proxy http://mydomain\\myusername:mypassword@myproxyserver:8080/
(Credit goes to @EugeneKulabuhov and @JaimeReynoso for the authentication format.)
Configure Git to use a proxy · GitHub, sslVerify=false clone https://domain.com/path/to/git git config --global --unset http.proxy git config --global --unset http.https://domain.com.proxy git config I used this for ssh protocol: How to connect to a git repository using the SSH protocol. Has anybody gotten HTTP fetches to consistently work through a proxy? What's really strange is that a few projects on GitHub work fine (awesome_nested_set for example), but others consistently fail (rails for example).
There's some great answers on this already. However, I thought I would chip in as some proxy servers require you to authenticate with a user Id and password. Sometimes this can be on a domain.
So, for example if your proxy server configuration is as follows:
Server: myproxyserver Port: 8080 Username: mydomain\myusername Password: mypassword
Then, add to your
.gitconfig file using the following command:
git config --global http.proxy http://mydomain\\myusername:mypassword@myproxyserver:8080
Don't worry about
https. As long as the specified proxy server supports http, and https, then one entry in the config file will suffice.
You can then verify that the command added the entry to your
.gitconfig file successfully by doing
At the end of the file you will see an entry as follows:
[http] proxy = http://mydomain\\myusername:mypassword@myproxyserver:8080
How do I pull from a Git repository through an HTTP proxy , With the help of following command first you need to set the HTTP proxy that Git uses in global configuration property http.proxy: $ git config If you just want to use proxy on a specified repository, don't need on other repositories. The preferable way is the -c, --config <key=value> option when you git clone a repository. e.g. It looks like you're using a mingw compile of Git on windows (or possibly another one I haven't heard about).
What finally worked was setting the
http_proxy environment variable. I had set
HTTP_PROXY correctly, but git apparently likes the lower-case version better.
Git Behind A Proxy Server, Git Behind A Proxy Server - How to modify your Git commands for proxies git config --global http.proxy http://<username>:<password>@<proxy-server-url>:<port> Once you have set these, your git pull , git push or even git fetch would work The remote repository in question is not in your machine, but it's within the The git clone command is used to pull the latest code from a GIT repository. But using it through a proxy can be annoying. Here is how to do this. Firstly; define your HTTP proxy information.
It looks like you're using a mingw compile of Git on windows (or possibly another one I haven't heard about). There are ways to debug this: I believe all of the http proxy work for git is done by curl. Set this environment variable before running git:
This should at least give you an idea of what is going on behind the scenes.
Can't clone or pull due to a git outbound proxy, When using Git via command line to push or pull, the following to access 'http://firstname.lastname@example.org:7990/scm/en/repo.git/': Failed You can use ssh to create a reverse tunnel. The Windows machine starts the ssh session, and forwards a port on the Linux box to the external git server (or itself if you're using a bare repo on the Windows machine). Then from the linux machine you set the git remote to be "localhost" and as far as Linux is concerned the git server is running locally.
If you just want to use proxy on a specified repository, don't need on other repositories. The preferable way is the
-c, --config <key=value> option when you
git clone a repository. e.g.
$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git --config "http.proxy=proxyHost:proxyPort"
How to use git through a proxy, How to open a SOCKS proxy through an SSH tunnel. The ssh How to connect to a git repository using the HTTP or HTTPS protocols. If the remote has a format To access any external sites, I need to pass through the proxy server. If I enter our proxy settings into SourceTree in Tools -> Options -> Network -> 'Use custom proxy settings' and tick 'Add proxy server configuration to Git / Mercurial' checkbox in the same page, I am able to connect to external git repositories.
how to use the git clone command through a http proxy. – Securitron , The git clone command is used to pull the latest code from a GIT repository. But using it through a proxy can be annoying. Here is how to do this This chapter covers every basic command you need to do the vast majority of the things you’ll eventually spend your time doing with Git. By the end of the chapter, you should be able to configure and initialize a repository, begin and stop tracking files, and stage and commit changes.
Git Config, Set up user name/email address Color the displayed output Set alias for Git command Without the --global option, this setting will only apply to a specific repository. You can also configure it using the following config command: $ git config --global http.proxy <address of the proxy server>:<port of the proxy server> By this, when we connect to the server by git push, git pull or other commands, git will first SSH to server.example.com. As the ssh client will check the config file, the above rule makes it set up a proxy by SSH to proxy.example.org and relaying the connection to %h (server.example.com) with port %p (22 by default for SSH) by nc (you need to
How to use git over an HTTP proxy, with socat, ssh proxy using corkscrew instead of socat; extra coolness for github If you're tracking a public repo, you will need to use the "git" protocol, because the "http" protocol is not very efficient, and/or proxied_git clone repo proxied_git pull. The following commands will initiate a local repository, add all files from your project to the repo, commit these files, add a remote origin (on Github), pull files from the remote repo (will pull README if you created one), and push files (whole project) to remote repo. ***** git init: git status: git add . git status: git commit -m "first
- Could your proxy be censoring some words or something, thereby only affecting those repos where those words happen to show up as part of the byte stream?
- possible duplicate of Getting git to work with a proxy server
- @alvaro, I think you mean that Getting git to work with a proxy server is a possible duplicate of this question. This question is older than the one to which you refer.
- @James, your "global" Git setting for the proxy server is not actually global, but local. To be global, you need to supply argument
- @DerekMahar Older questions may be closed of duplicates of newer questions, if the newer question is better quality (or more generally applicatble).
- This worked for me: Set HTTP_PROXY in environment for user (on Windows), then the above comment with $HTTP_PROXY (uppercase). +1 for this solution.
- CleverCoder, on Windows, you need to specify %HTTP_PROXY%, not $HTTP_PROXY (unless you're running Cygwin, of course). I will edit my answer to work in Windows instead of a Unix environment.
- where do i put the username and password for proxy?
git config --global http.proxy http://mydomain\\myusername:mypassword@myproxyserver:8080syntax to provide username/password
- For anyone who might be having problems with the proxy, http://<UserID>:<Password>@<ProxyURL>:<Port>/ worked for me
- Interesting. I am able to get to the "Resolving deltas" portion with 100% but then it looks like the clone process just hangs. Anyone experienced that?