Git connects to the Internet through proxy

Source: Internet
Author: User

In many cases, the Intranet can only access internal git servers and cannot access external resources (such as GitHub or various open-source projects ). The following uses Ubuntu as an example to describe how to access the GIT library through proxy.

1. Install connect-Proxy:

$ Apt-Get install connect-proxy

2. write the script gitproxy. sh:

#! /Bin/sh

Connect-s proxy.company.com: 1234 $ @

Of course, some advanced filtering functions can also be added in practice, such as Intranet git does not need a proxy, but the Internet only needs to pass the proxy, and so on.

Then add the execution permission and copy it to the path:

$ Chmod 775 gitproxy. Sh

# Cp gitproxy. sh/usr/bin/

3. Finally, write the script into git Configuration:

$ Git config -- global core. gitproxy. Sh

Now you can try it:

Jzj @ jzj-LAPTOP :~ /Tmp $ git clone git: // git.seabios.org/seabios.git seabios
Initialized empty git repository in/home/jzj/tmp/seabios/. Git/
Remote: counting objects: 8801, done.
Remote: compressing objects: 100% (3465/3465), done.
Remote: Total 8801 (delta 6994), reused 6639 (delta 5330)
Grouping objects: 100% (8801/8801), 2.02 MIB | 77 kib/s, done.
Resolving deltas: 100% (6994/6994), done.

Related Article

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.