Cannot get Http on git to work

2019-01-08 00:18发布

问题:

I am using gitbash for git on my thumbdrive. I have a firewall blocking me and would like to set up my git for http access. I use github and I have seen all kinds of infomation on how to do so but I do not understand enough to make it work for my self. I have curl enabled in the php.ini file and that is about as far as I have been able to get done. Before you attempt to assist me please understand that I am not a command line guru so with any command line instructions please be detailed as if it is my first time using one (I use consolePortable BTW). Also let me know where exactly I should be as far as the "root" or a specific folder to run any suggested commands. I use xampp on my thumbdrive so if there is a path to curl or any thing that I have to set please let me know where I should find it and not eg. . I am not trying to be difficult I just want to get this set up.

Thank you.

回答1:

If your firewall allows https, you can use the https-based address of your GitHub repo to push/pull.

You need:

  • to define in your gitbash session http_proxy and https_proxy environment variable (to the right proxy, with your internet login and password):
    export https_proxy=http://<login_internet>:<password_internet>@aproxy:aport
  • to define where your git will look for the CAs:
    git config --system http.sslcainfo /bin/curl-ca-bundle.crt
  • to make sure you have a HOME environment variable defined (to any directory you want)
  • to have in %HOME% a _netrc file (note the '_') with in it:
machine github.com
login YourGitHubLogin
password YourGitHubPassword

From there, all your git pull/git push from and to GitHub repo will work!