I recently had to debug an issue where the Git client refused to connect to an http url to fetch content, but worked well on the https url. I was curious to find out what was happening under the hood. It turned out that the http end point was configured to redirect to https url and the Git client (1.7.1) that was under test failed to honor the redirect request. I had googled to find out about GIT_CURL_VERBOSE and decided to search the Git source for more of these. I am sharing here few tips to debug and fix http(s) related issues in Git client (Git for linux/msysgit for windows), which I feel can be useful in debugging or fixing remote http(s) helper.
GIT_CURL_VERBOSE – Set this environmental variable to a Boolean value to debug the curl transaction while accessing the repository via http(s) remote helper
Example
GIT_CURL_VERBOSE=1 git ls-remote https://github.com/git/git.git
Use Case(s)
-Troubleshooting curl related issues
GIT_SSL_NO_VERIFY – Set this environmental variable to a Boolean value to disable the SSL certificate verification while accessing the repository via https remote helper
Example
GIT_SSL_NO_VERIFY=1 git ls-remote https://207.97.227.239/git/git.git
(github.com resolved to 207.97.227.239 on 13/03/2013)
Use Case(s)
-Self Signed SSL Certificates.
-Internal CA certificate in an corporate environment
GIT_HTTP_LOW_SPEED_LIMIT – Set this environmental variable to a value greater than zero, representing the download speed in bytes per second.
GIT_HTTP_LOW_SPEED_TIME – Set this environmental variable to a value greater than zero, representing the time in seconds.
When these two environmental variables are set to values more than zero, the git remote operations over http(s) remote helper will terminate if the download speed maintains at or below
GIT_HTTP_LOW_SPEED_LIMIT bytes per second for GIT_HTTP_LOW_SPEED_LIMIT second(s)
Example
GIT_HTTP_LOW_SPEED_LIMIT=2000 GIT_HTTP_LOW_SPEED_TIME=5 git clone
https://github.com/git/git.git
(To simulate the network speed one can use trickle on linux)
Use Case(s)
-To include in scripts that should not be locked for a long duration because of a slow network connectivity.
GIT_HTTP_USER_AGENT – Set this environmental variable to the string that would be presented to the server as the User-Agent string, when accessing the repository via http(s) remote helper
Example
GIT_HTTP_USER_AGENT=CustomAgent/1.0 GIT_CURL_VERBOSE=1 git ls-remote https://github.com/git/git.git
Use Case(s)
-If there are proxies that limits the internet connectivity based on the User-Agent string, this environmental variable can be set to a browser User-Agent string that is accepted by the proxy.
For more information on Git, please visit http://visit.collab.net/gotgit.html (Tweet This!) or you may contact CollabNet.
The post Tips on Git appeared first on blogs.collab.net.