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).
This question is related to
git
proxy
git-submodules
This isn't a problem with your proxy. It's a problem with github (or git). It fails for me on git-1.6.0.1 on linux as well. Bug is already reported (by you no less).
Make sure to delete your pasties, they're already on google. Edit: Must've been dreaming, i guess you can't delete them. Use Gist instead?
I got around the proxy using https... some proxies don't even check https.
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
c:\git\meantest>git clone http://github.com/linnovate/mean.git
Cloning into 'mean'...
fatal: unable to access 'http://github.com/linnovate/mean.git/': Failed connect
to github.com:80; No error
c:\git\meantest>git clone https://github.com/linnovate/mean.git
Cloning into 'mean'...
remote: Reusing existing pack: 2587, done.
remote: Counting objects: 27, done.
remote: Compressing objects: 100% (24/24), done.
rRemote: Total 2614 (delta 3), reused 4 (delta 0)eceiving objects: 98% (2562/26
Receiving objects: 100% (2614/2614), 1.76 MiB | 305.00 KiB/s, done.
Resolving deltas: 100% (1166/1166), done.
Checking connectivity... done
you can use:
git config --add http.proxy http://user:password@proxy_host:proxy_port
For me the git:// just doesn't work through the proxy although the https:// does. This caused some bit of headache because I was running scripts that all used git:// so I couldn't just easily change them all. However I found this GEM
git config --global url."https://github.com/".insteadOf git://github.com/
This worked to me.
git config --global http.proxy proxy_user:proxy_passwd@proxy_ip:proxy_port
As this was answered by many but This is just for Winodws USER who is behind proxy with auth.
Re-Installing(first failed, Don't remove).
Goto ->
**Windows**
1. msysgit\installer-tmp\etc\gitconfig
Under [http]
proxy = http://user:pass@url:port
**Linux**
1. msysgit\installer-tmp\setup-msysgit.sh
export HTTP_PROXY="http://USER:[email protected]:8080"
if you have any special char in user/pass use url_encode
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"
I had the same problem, with a slightly different fix: REBUILDING GIT WITH HTTP SUPPORT
The git:
protocol did not work through my corporate firewall.
For example, this timed out:
git clone git://github.com/miksago/node-websocket-server.git
curl github.com
works just fine, though, so I know my http_proxy
environment variable is correct.
I tried using http
, like below, but got an immediate error.
git clone http://github.com/miksago/node-websocket-server.git
->>> fatal: Unable to find remote helper for 'http' <<<-
I tried recompiling git like so:
./configure --with-curl --with-expat
but still got the fatal error.
Finally, after several frustrating hours, I read the configure file, and saw this:
# Define CURLDIR=/foo/bar if your curl header and library files are in
# /foo/bar/include and /foo/bar/lib directories.
I remembered then, that I had not complied curl
from source, and so went
looking for the header files. Sure enough, they were not installed. That was the problem. Make did not complain about the missing header files. So
I did not realize that the --with-curl
option did nothing (it is, in fact the default in my version of git
).
I did the following to fix it:
Added the headers needed for make:
yum install curl-devel
(expat-devel-1.95.8-8.3.el5_5.3.i386 was already installed).
Removed git
from /usr/local
(as I want the new install to live there).
I simply removed git*
from /usr/local/share
and /usr/local/libexec
Searched for the include dirs containing the curl
and expat
header files, and then (because I had read through configure
) added these to the environment like so:
export CURLDIR=/usr/include
export EXPATDIR=/usr/include
Ran configure
with the following options, which, again, were described in the configure
file itself, and were also the defaults but what the heck:
./configure --with-curl --with-expat
And now http
works with git
through my corporate firewall:
git clone http://github.com/miksago/node-websocket-server.git
Cloning into 'node-websocket-server'...
* Couldn't find host github.com in the .netrc file, using defaults
* About to connect() to proxy proxy.entp.attws.com port 8080
* Trying 135.214.40.30... * connected
...
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:
GIT_CURL_VERBOSE=1
This should at least give you an idea of what is going on behind the scenes.
Set Git credential.helper to wincred.
git config --global credential.helper wincred
Make sure there is only 1 credential.helper
git config -l
If there is more than 1 and it's not set to wincred remove it.
git config --system --unset credential.helper
Now set the proxy with no password.
git config --global http.proxy http://<YOUR WIN LOGIN NAME>@proxy:80
Check that all the settings that you added looks good....
git config --global -l
Now you good to go!
I find neither http.proxy
nor GIT_PROXY_COMMAND
work for my authenticated http proxy. The proxy is not triggered in either way. But I find a way to work around this.
Create a authfile. The format for authfile
is: user_name:password
, and user_name
, password
is your username and password to access your proxy. To create such a file, simply run command like this: echo "username:password" > ~/.ssh/authfile
.
Edit ~/.ssh/config
, and make sure its permission is 644
: chmod 644 ~/.ssh/config
Take github.com as an example, add the following lines to ~/.ssh/config
:
Host github.com
HostName github.com
ProxyCommand /usr/local/bin/corkscrew <your.proxy> <proxy port> %h %p <path/to/authfile>
User git
Now whenever you do anything with [email protected]
, it will use the proxy automatically. You can easily do the same thing to Bitbucket as well.
This is not so elegant as other approaches, but it works like a charm.
For me what it worked was:
sudo apt-get install socat
Create a file inside your $BIN_PATH/gitproxy with:
#!/bin/sh
_proxy=192.168.192.1
_proxyport=3128
exec socat STDIO PROXY:$_proxy:$1:$2,proxyport=$_proxyport
Dont forget to give it execution permissions
chmod a+x gitproxy
Run following commands to setup environment:
export PATH=$BIN_PATH:$PATH
git config --global core.gitproxy gitproxy
You can also set the HTTP proxy that Git uses in global configuration property http.proxy
:
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.)
git config --global http.proxy http://user:password@domain:port
git config --global http.proxy http://clairton:[email protected]:8080
Worth to mention: Most examples on the net show examples like
git config --global http.proxy proxy_user:proxy_passwd@proxy_ip:proxy_port
So it seems, that - if your proxy needs authentication - you must leave your company-password in the git-config. Which isn't really cool.
But, if you just configure the user without password:
git config --global http.proxy proxy_user@proxy_ip:proxy_port
Git seems (at least on my Windows-machine without credentials-helper) to recognize that and prompts for the proxy-password on repo-access.
$http_proxy is for http://github.com.... $https_proxy is for https://github.com...
The above answers worked for me when my proxy doesn't need authentication. If you are using proxy which requires you to authenticate then you may try CCProxy. I have small tutorial on how to set it up here,
http://blog.praveenkumar.co.in/2012/09/proxy-free-windows-xp78-and-mobiles.html
I was able to push, pull, create new repos. Everything worked just fine. Make sure you do a clean uninstall and reinstall of new version if you are facing issues with Git like I did.
Use proxychains
proxychains git pull ...
update: proxychains is discontinued, use proxychains-ng instead.
as @user2188765 has already pointed out, try replacing the git://
protocol of the repository with http[s]://
. See also this answer
When your network team does ssl-inspection by rewriting certificates, then using a http url instead of a https one, combined with setting this var worked for me.
git config --global http.proxy http://proxy:8081
For Windows
Goto --> C:/Users/user_name/gitconfig
Update gitconfig file with below details
[http]
[https]
proxy = https://your_proxy:your_port
[http]
proxy = http://your_proxy:your_port
How to check your proxy and port number?
Internet Explorer -> Settings -> Internet Options -> Connections -> LAN Settings
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 cat .gitconfig
:
At the end of the file you will see an entry as follows:
[http]
proxy = http://mydomain\\myusername:mypassword@myproxyserver:8080
That's it!
Just to post this as it is the first result on Google, this blog post I found solves the problem for me by updated the curl certificates.
http://www.simplicidade.org/notes/archives/2011/06/github_ssl_ca_errors.html
This is an old question but if you are on Windows, consider setting HTTPS_PROXY as well if you are retrieving via an https URL. Worked for me!
On Windows, if you don't want to put your password in .gitconfig in the plain text, you can use
It authenticates you against normal or even Windows NTLM proxy and starts localhost-proxy without authentication.
In order to get it run:
Point git to your new localhost proxy:
[http]
proxy = http://localhost:3128 # change port as necessary
You could too edit .gitconfig file located in %userprofile% directory on Windows system (notepad %userprofile%.gitconfig) or in ~ directory on Linux system (vi ~/.gitconfig) and add a http section as below.
Content of .gitconfig file :
[http]
proxy = http://proxy.mycompany:80
The below method works for me:
echo 'export http_proxy=http://username:password@roxy_host:port/' >> ~/.bash_profile
echo 'export https_proxy=http://username:password@roxy_host:port' >> ~/.bash_profile
Source: Stackoverflow.com