如果公司使用代理,Git就需要設置代理才能克隆遠程倉庫
執行下面兩條語句
git config --global http.proxy "10.167.32.133:8080"
git config --global https.proxy "10.167.32.133:8080"
如果需要用戶名和密碼
git config –global http.proxy http://user:password@10.167.32.133:8080
git config –global http.proxy https://user:password@10.167.32.133:8080
然后就可以使用
git clone http://github.com/weiheli/sass-zh.git
# 或
git clone http://github.com/weiheli/sass-zh.git
不能用
git clone git@github.com:weiheli/sass-zh.git
刪除HTTP代理
git config --system (或 --global 或 --local) --unset http.proxy
git config --system (或 --global 或 --local) --unset https.proxy
GitHub Desktop
如果使用Github推出的桌面程序GitHub Desktop
,里面可能并沒有代理設置的選項,不過這些客戶端一般在底層都是調用的命令行工具,所以同樣按照上述步驟進行設置即可。
轉自http://blog.csdn.net/wozaixiaoximen/article/details/48434853