Git proxy settings and access GitHub

Source: Internet
Author: User
Tags ssh access git clone ssh config ssh config file opentsdb
Because of the current work of the network environment has very strict restrictions, it can be said that the recent GitHub through the proxy visit quite a few setbacks, but also accumulated some relevant experience, feel the need to remember. The spirit of "do not reinvent the wheel," the purpose of this article will not be GitHub proxy settings for each detail to repeat, the article will give a ready-made reference articles, here to do is to address some important issues to explain and supplement, I believe you will be able to meet the same problem friends to help. The source of this article: http://blog.csdn.net/bluishglc/article/details/37807501 is strictly prohibited in any form of reprint, otherwise will entrust CSDN official maintenance rights and interests.

1. Don't toss it, please block NTLM authentication first.

First of all, if your network agent is using NTLM authentication, do not make any unnecessary "struggle", please install CNTLM, set up a normal HTTP proxy without authentication, because the current version of Git does not support NTLM authentication agent, without first using CNTLM to screen out NTLM authentication, Any subsequent work would be meaningless. For CNTLM installation and configuration please refer to: http://blog.csdn.net/bluishglc/article/details/37600773

2. Git agent configuration walk up

For the configuration of the Git agent, please refer to: http://jixiuf.github.io/git/git-proxy-on-windows.html Here is a brief explanation of the SSH config file mentioned in the article, This file is primarily to save the connection configuration of some frequently accessed target hosts, much like the session saved in Putty. The config file is structured as a set of configuration items that start with host and are configured for this host before the host item is followed to the next host. In addition, the config file refers to connect is a proxy forwarding tool, for a simple command-line tool is not likely to design how to configure the agent, or like SSH in order to ensure the function of the program itself, the proxy configuration entrusted to the Third-party tools to implement, this is the role of Connect.

3. https://. OK. git://. No way.

Installation configuration Good CNTLM, refer to the previous article to configure, we can check out the GitHub on the https://described repository, if you try to use git:// or git@github.com format, the following errors may be reported in some proxy environments:

http/1.1 502 Proxy Error (The specified Secure Sockets Layer (SSL) port is not allowed. Forefront TMG is isn't configured to allow SSL requests from this port.  Most Web browsers use port 443 for SSL requests. )

This problem is caused by the fact that the 22 ports used by git://in the 9418-port and git@github.com-formatted addresses of SSH are blocked by firewalls in your network environment (especially the proxy server). This is extremely common, and most proxy environments are based on security considerations, shielding ports other than (HTTP) and 443 (HTTPS). Does that mean we can't use git://or git@github.com addresses in this network environment? Please continue to see below.


4. Fortunately you: SSH over the HTTPS port


Although you can use the HTTPS protocol push code on the GitHub (using the username and password of the user name on GitHub), it is generally safer to use SSH to check out and submit code, which is better for team development, so how to solve the problem mentioned above. In this respect, github specifies the connection port of SSH as 443 for HTTPS use, Using another host name: Ssh.github.com to solve this problem, so we can use the most proxy server allow 443 ports, using SSH access to GitHub, which is in the previous reference to the config file is also configured, is the host for SSH.GITHUB.C The OM section, the description and configuration of this section, GitHub's official help documentation also has instructions: Https://help.github.com/articles/using-ssh-over-the-https-port. Here I just want to say how to verify that the configuration has been successful, obviously, as long as we can login to the target host via SSH indicates that the configuration is correct:

Method One: Like the reference article we mentioned earlier, it writes the configuration parameters of ssh.github.com into the SSH config file so that it can be used in the command line tool

ssh-t-P 443 git@ssh.github.com

You can verify that the config file is configured correctly and prompt after successful login:

Method Two: If we are not sure of the correctness of these parameters before we configure them, we can specify them by command line and write them to the config file after the validation passes. The command at this point is to write this:

Ssh-o proxycommand= "/path/to/connect-h proxy Host: Port%h%p"-i "/path/to/your/github_private_key"-t-p 443

Prompt after successful login:


Method Three: We can also through putty in another completely independent and convenient way to verify that, that is, in the putty to establish a session, Target host is ssh.github.com, port 443, login username 443, specify your GitHub private key (note: Putty use of the private key and OpenSSH private key format is not the same, if you do not save the putty format of the private key to the putty of the keygen tool to generate or turn ), set the agent host and port and then connect, if the following diagram prompts, also indicates that the configuration is correct.


The last special reminder is that after the successful configuration verification, we must remember to modify the host name when checking out the project from the GitHub, and change the git@github.com to git@ssh. github.com to check out the OPENTSDB project as an example, the command

git clone git@github.com:opentsdb/opentsdb.git

Into:

git clone git@ssh.github.com:opentsdb/opentsdb.git


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.