Use HTTP proxy to download source code (git svn) using various SCM tools)

Source: Internet
Author: User

Reprinted from:

Http://www.linuxeden.com/html/develop/20090723/66951.html

Http://mysuperbaby.iteye.com/blog/935741

 

It is often necessary to use SCM to download source code, especially for software developers. However, our network environment often forces us to use proxies, or because of speed or direct connection. In addition, the source code is usually a small file of several thousand or tens of thousands. Unlike the general software, a single file can be used as a download tool.

1. CVS
CVS is very troublesome to use proxy. It seems that it cannot be used as an HTTP proxy (if an error occurs, please remind me), and socks proxy is rather difficult to find. Fortunately, this stuff has gradually become yellow yesterday. We will not discuss it.

2. SVN
SVN is easy to edit ~ /. Subversion/servers file:
[Global]
HTTP-proxy-host = <proxy IP address or Domain Name>
HTTP-proxy-Port = <proxy port>
HTTP-proxy-username = <user name, if needed>
HTTP-proxy-Password = <password, if needed>

3, Hg
Hg is simpler, because it uses the HTTP protocol. A command solves the following problems:
Export http_proxy = http: // <user name >:< password >@< IP >:< port>

4. Git
Git can use two Protocols: git protocol and HTTP protocol. If it is the latter, the method is the same as Hg. If it is git, It is troublesome, but it is not unsolvable:
First download a protocol conversion tool: http://www.meadowy.org /~ Gotoh/ssh/connect. c
Compiled by: gcc-O connect. c
Place the generated connect to the executable file path, such as/usr/bin.

Create a script using the proxy, for example, HTTP-proxy-GW. Note that the executable attribute is added. The content is as follows:
#! /Bin/sh
# Filename :~ /Bin/HTTP-proxy-GW
# This script connects to an HTTP Proxy using connect. c
Connect-H http: // yourproxyaddress: proxyport $ @

Finally, configure git:
Git config -- global core. gitproxy "http-proxy-GW for XXX. yyy"
The following XXX. YYY is the domain name suffix. For example, to download the Linux source code, you can set it to kernel.org.

 

2012 7.25 Add:

In the above method, I only tried to download git as a second-level agent in the company. It works fine

1. Compile connect

2. Write a script gitproxy. Sh (remember that both files require the CHMOD + x permission)

The content of gitproxy. Sh is as follows:

 

#! /Bin/sh

# Filename :~ /Bin/socks-GW

# This script connects to a SOCKS proxy using connect. c

/Home/<youraccount>/bin/connect-hproxyserver: Port $ @

 

Explanation:

<Youraccount> is your account.

Proxyserver: Port indicates your proxy IP address and port.

 

3. Upload the two files to/home/<youraccount>/bin. Create

 

4. Configure git parameters and use proxy scripts

Git config -- global core. gitproxy "$ {home}/bin/gitproxy. Sh"

 

5. Git Chone *** success

 

I have added 20120801 git proxy configuration issues.

Today, I encountered a new situation where a newly installed Ubuntu server directly copies the connect execution file and execution script generated by my previous compilation. An error is reported during each operation.

Syntax Error

Connect later. c copied it to GCC and re-compiled it. The problem was solved. Later, I realized that my previous 64-bit Ubuntu, and this is a 32bit system. It is estimated that the compiled file is incompatible.

 

 

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.