android原始碼下載時的git/repo代理設定 .

來源:互聯網
上載者:User

這篇文章的背景,是我在ubuntu下配置android環境以及擷取android原始碼時所遇到的問題,關於怎樣在ubuntu/linux下android環境我在此就不多少了,可以參考android的官方網站,這裡給出連結http://source.android.com/source/download.html。下面主要說一下關於在公司內網不能下載原始碼的解決辦法。

 

關於怎樣設定git代理,網上有很多方法,但都是大同小異,下面介紹一下我的解決辦法。

1. On Linux/ubuntu machine, please install connect-proxy

  #sudo apt-get install connect-proxy

2. Create a simple shell script named socks-gw.sh

   #!/bin/sh
   # Filename: ~/bin/socks-gw
   # This script connects to a SOCKS proxy
   connect-proxy –S your.socks.proxy.com:port $@

3. Edit a simple shell script named socks-ssh.sh

   #!/bin/sh
   # Filename: ~/bin/socks-ssh
   # This script opens an SSH connection through a SOCKS server
   ssh -o ProxyCommand="${HOME}/bin/socks-gw %h %p" $@

4. Edit a simple shell script named proxy.sh

 

     #!/bin/sh
    # Filename: ~/bin/ proxy
    # This script sets Git to use the SOCKS proxy
    export GIT_SSH="${HOME}/bin/socks-ssh"
    export GIT_PROXY_COMMAND="${HOME}/bin/socks-gw"

Note :please make sure socks-ssh and socks-gw in the right path

5. Execute proxy.sh every time before you want to use git.

 

說明幾個問題:

1. 網上很多資料都提到了下載一個connect.c 檔案,然後編譯,其實那個connect.c檔案就是我們安裝的connect-proxy。

2. 關於connect-proxy 的參數問題,-S指用的是socks代理,-H指的是用HTTP代理,要非常注意,具體socks代理和http代理的區別,可以google

3. 如果想用HTTP代理,網上的很多方法就通用了。

reference:http://threebytesfull.com/2008/04/git-with-and-without-proxy

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.