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.