git config --global https.proxy http://127.0.0.1:1080 | |
git config --global https.proxy https://127.0.0.1:1080 | |
git config --global --unset http.proxy | |
git config --global --unset https.proxy | |
npm config delete proxy |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
git config --local https.proxy https://127.0.0.1:1080 我这样配置有什么问题么?为什么还是没走ss代理呢? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
itolfh
on 13 Jan 2016
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'
git config --global http.proxy 'socks5://127.0.0.1:1080' |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Thanks! |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
zhuyingda
on 28 Sep 2016
请问一下,我只设置了git config --global https 而没设置git config --global http的时候,clone一个google的git仓库依然不行,后来加上了http的设置才可以,我也是ss代理 端口都和你们一样,有人知道这是为什么吗? 我的clone仓库url是https的啊,但还是需要把http和https代理都挂上才可以吗?
请问一下,我只设置了git config --global https 而没设置git config --global http的时候,clone一个google的git仓库依然不行,后来加上了http的设置才可以,我也是ss代理 端口都和你们一样,有人知道这是为什么吗? 我的clone仓库url是https的啊,但还是需要把http和https代理都挂上才可以吗? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
@zhuyingda 显然是 https 不起作用,只有 http 起作用 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
It works. Thank you very much. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
thanks a lot |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
thanks! |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
thanks! Working for me. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Thank you! It works for me. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
it works! thanks! |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
it works! thanks a lot! |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
这个是http和https 代理把? 如果我想用ssh呢? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
it works!顶一个 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
thx~ |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
在天朝 使用 git clone 的正确姿势哇 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
现在什么都要设代理,yum npm git wget...天朝......................................... |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
thanks @itolfh |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
leetking
on 28 Mar 2017
我如此设置之后clone gist同样没有被代理
git设置
[http]
proxy = socks5://127.0.0.1:1080
[https]
proxy = socks5://127.0.0.1:1080
本地ss5端口
$ nmap localhost
Starting Nmap 7.01 ( https://nmap.org ) at 2017-03-28 23:05 CST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000035s latency).
Not shown: 998 closed ports
PORT STATE SERVICE
1080/tcp open socks
Nmap done: 1 IP address (1 host up) scanned in 0.04 seconds
ss查看开放端口信息
$ ss -tln | grep 1080
LISTEN 0 128 127.0.0.1:1080 *:*
我确信ss5已经打开并且能用,毕竟浏览器能用。
但是在
$ git clone https://gist.github.com/666dd7b27e9116faece6.git
正克隆到 '666dd7b27e9116faece6'...
fatal: unable to access 'https://gist.github.com/666dd7b27e9116faece6.git/': gnutls_handshake() failed: The TLS connection was non-properly terminated.
出现如上错误,我不知道是不是我的git设置问题呢。在这里提问抱歉了。我也google搜索了很久,只有在您这里提到了设置ss5。
谢谢
我如此设置之后clone gist同样没有被代理git设置
本地ss5端口 $ nmap localhost
Starting Nmap 7.01 ( https://nmap.org ) at 2017-03-28 23:05 CST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000035s latency).
Not shown: 998 closed ports
PORT STATE SERVICE
1080/tcp open socks
Nmap done: 1 IP address (1 host up) scanned in 0.04 seconds
ss查看开放端口信息
我确信ss5已经打开并且能用,毕竟浏览器能用。 $ git clone https://gist.github.com/666dd7b27e9116faece6.git
正克隆到 '666dd7b27e9116faece6'...
fatal: unable to access 'https://gist.github.com/666dd7b27e9116faece6.git/': gnutls_handshake() failed: The TLS connection was non-properly terminated. 出现如上错误,我不知道是不是我的git设置问题呢。在这里提问抱歉了。我也google搜索了很久,只有在您这里提到了设置ss5。 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
@leetking |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
raidsan
on 21 Apr 2017
注意: 代理地址不要加引号!
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'
大部分网站下载没问题, 但是遇到 gclient 下载会出错, 去掉引号号后成功
注意: 代理地址不要加引号! |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
thanks for sharing. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
thanks!LOL! |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
问下 我想代理 git://git.com 这种开头应该怎么加 ,试了下 不行 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
hippasus
on 26 Jun 2017
@zhangle1 使用 git@xxoo.com 这种方式,是用的 SSH 协议。需要在 ~/.ssh/config 目录下配置
Host xxoo.com(改成你的站点)
ProxyCommand connect -H 127.0.0.1:1080 %h %p
@zhangle1 使用 git@xxoo.com 这种方式,是用的 SSH 协议。需要在 ~/.ssh/config 目录下配置 Host xxoo.com(改成你的站点) |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
补充两点: |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
请问带s和不带s有什么区别 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
8enet
on 21 Sep 2017
对于使用git@协议的,可以配置socks5代理
在~/.ssh/config 文件后面添加几行,没有可以新建一个
Host github.com
ProxyCommand nc -X 5 -x 127.0.0.1:1080 %h %p
对于使用git@协议的,可以配置socks5代理
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
为什么我设置了代理还是会time out |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
为什么我设置了代理还是会time out 我也是 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
windows 按照 itolfh 说的可以成功 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
thanks @itolfh |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
https.proxy 根本就不存在这个设置好吗 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
VOID001
on 29 Mar 2018
git 是没有 https 这个 config section 的
如果想要使用SOCKS5代理的话只需要
git config --global http.proxy "socks5h://your_addr:your_port"
即可
git 是没有 https 这个 config section 的 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
git 的 ssh 代理终于在这里找到了答案 万分感谢 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
XinzeZhang
on 12 Apr 2018
在windows上,在Git Bash里设置
ProxyCommand nc -X 5 -x 127.0.0.1:1080 %h %p
会报错的,提示:
/usr/bin/bash: line 0: exec: nc: not found
因为这个bash是不带netcat的,也就找到不到nc命令。
在win10上,有的msysgit版本集成了connect工具,所以在windows上,可以把ssh的config文件设置为:
Host github.com
ProxyCommand connect -S 127.0.0.1:1080 %h %p
就可以给ssh加socks代理了。
在windows上,在Git Bash里设置
会报错的,提示:
因为这个bash是不带netcat的,也就找到不到nc命令。
就可以给ssh加socks代理了。 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
If it doesn't work, |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
vipzrx
on 17 Apr 2018
按照
#只对github.com
git config --global http.https://github.com.proxy socks5://127.0.0.1:1080
#取消代理
git config --global --unset http.https://github.com.proxy)
设置
速度感人!!!
git config --global --unset http.https://github.com.proxy) 多了一个 )
git config --global --unset http.https://github.com.proxy) 多了一个 ) |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
thx |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
@Jimmy-Z socks5h效果提升太明显 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
XxYyKk
on 1 May 2018
为什么我还是不行啊 socks代理127.0.0.1:1080
git config --global http.proxy 'socks5://127.0.0.1:1080'
https加上也不行
都是
: gnutls_handshake() failed: The TLS connection was non-properly terminated.
为什么我还是不行啊 socks代理127.0.0.1:1080 git config --global http.proxy 'socks5://127.0.0.1:1080' https加上也不行 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
leegcc
on 3 May 2018
@XxYyKk @leetking gnutls_handshake() failed: The TLS connection was non-properly terminated. 这个问题我也遇到,但我按 https://blog.csdn.net/qq_38199832/article/details/77803645 这文章的方式解决了。不知道具体什么情况。。。
@XxYyKk @leetking gnutls_handshake() failed: The TLS connection was non-properly terminated. 这个问题我也遇到,但我按 https://blog.csdn.net/qq_38199832/article/details/77803645 这文章的方式解决了。不知道具体什么情况。。。 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
it's work for me . |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
怎么检查自己是否设置成功啊? 我感觉 git clone 的速度没有变化啊... |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
@whyscience 为何我设置了之后提示 Unable to receive initial SOCKS5 response. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
这里可能对你有帮助 https://www.jianshu.com/p/77f773f492c6 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
lxq1
on 20 Jul 2018
在Windows7系统下,我是用的 SSH 协议。需要在 用户根目录/.ssh/config 文件下配置,没有config的话就自行创建。
Host github.com
ProxyCommand connect -H 127.0.0.1:1080 %h 22
测试成功使用socks5
在Windows7系统下,我是用的 SSH 协议。需要在 用户根目录/.ssh/config 文件下配置,没有config的话就自行创建。 Host github.com 测试成功使用socks5 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
原来ssh需要另外设置,现在才发现难怪https和ssh差那么多 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
已经成功~谢谢 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
My git works when i do as@itolfh says, thanks |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
vkso
on 24 Oct 2018
There are two ways to clone in GitHub.
- Clone with HTTPS:
git clone https://github.com/xxx/xxx.git
- Clone with SSH:
git clone git@github.com:xxx/xxx.git
If you don't set up a proxy for local SSH, cloning using SSH will not take the proxy.
If you want to use the socks5 proxy, you only need one command
git config --global http.proxy socks5://your-server:your-port
Unset proxy:
git config --global --unset http.proxy
It works in my Ubuntu 16.04.
There are two ways to clone in GitHub.
If you don't set up a proxy for local SSH, cloning using SSH will not take the proxy. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
rangercyh
on 31 Jan 2019
对于使用git@协议的,可以配置socks5代理
在~/.ssh/config 文件后面添加几行,没有可以新建一个Host github.com ProxyCommand nc -X 5 -x 127.0.0.1:1080 %h %p
就你的方法我成功了。。
就你的方法我成功了。。 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
zzqcn
on 14 Feb 2019
结合以上各位经验设置成功. 以下以macOS为准.
-
https访问
仅为github.com设置socks5代理(推荐这种方式, 公司内网就不用设代理了, 多此一举):
git config --global http.https://github.com.proxy socks5://127.0.0.1:1086
其中1086是socks5的监听端口, 这个可以配置的, 每个人不同, 在macOS上一般为1086.
设置完成后, ~/.gitconfig文件中会增加以下条目:[http "https://github.com"] proxy = socks5://127.0.0.1:1086
-
ssh访问
需要修改~/.ssh/config文件, 没有的话新建一个. 同样仅为github.com设置代理:Host github.com User git ProxyCommand nc -v -x 127.0.0.1:1086 %h %p
如果是在Windows下, 则需要个性%home%.ssh\config, 其中内容类似于:
Host github.com User git ProxyCommand connect -S 127.0.0.1:1086 %h %p
这里-S表示使用socks5代理, 如果是http代理则为-H. connect工具git自带, 在<Git>\mingw64\bin\下面.
结合以上各位经验设置成功. 以下以macOS为准.
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
smarxpan
on 3 Mar 2019
设置代理
git config --global http.proxy socks5h://127.0.0.1:1080
取消代理
git config --global --unset http.proxy
因为我用的是shadowsocks代理,所以上面是socks5h://
, 如果用的是http代理,将socks5h改为http即可
如果仅仅想为github设置代理,可以这样:
git config --global http.https://github.com.proxy socks5h://127.0.0.1:1080
对于使用git@协议的,可以配置socks5代理
在~/.ssh/config 文件后面添加几行(没有可以新建一个)
Host github.com
User git
ProxyCommand nc -X 5 -x 127.0.0.1:1080 %h %p
windows使用:
Host github.com
User git
ProxyCommand connect -S 127.0.0.1:1080 %h %p
设置代理
取消代理
因为我用的是shadowsocks代理,所以上面是 如果仅仅想为github设置代理,可以这样:
对于使用git@协议的,可以配置socks5代理
windows使用:
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
@whyscience 你的方法有用 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
liuzhenyulive
on 20 Mar 2019
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'
it worked,thanks
it worked,thanks |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Skura23
on 30 Mar 2019
本人结合 zzqcn 和 smarxpan两位朋友的配置最后解决了,
尤其是zzqcn 提到的
其中1086是socks5的监听端口, 这个可以配置的, 每个人不同, 在macOS上一般为1086.
也就是说如果你是用的ss的话, 那么这里的地址就是本机地址127.0.0.1
, 端口就是ss在本地的端口,
windows默认是1080, mac是1086, 而我之前一直设置地址和端口是源服务器地址端口, 所以一直不行
另外一点是如果是使用git@协议的链接, 则要配置~/.ssh/config
, 否则仅http/https
链接代理生效, 上面都有提到
本人结合 zzqcn 和 smarxpan两位朋友的配置最后解决了,
也就是说如果你是用的ss的话, 那么这里的地址就是本机地址 另外一点是如果是使用git@协议的链接, 则要配置 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
取消代理也要如下命令吗?
还是说 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
shouyong
on 17 May 2019
➜ src export https_proxy=socks5://127.0.0.1:1086
➜ src export http_proxy=socks5://127.0.0.1:1086
➜ src git clone https://github.com/xxxx/xxx.git
测试可行!
➜ src export https_proxy=socks5://127.0.0.1:1086
➜ src export http_proxy=socks5://127.0.0.1:1086
➜ src git clone https://github.com/xxxx/xxx.git 测试可行! |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
onloner2012
on 10 Jul 2019
There are two ways to clone in GitHub.
- Clone with HTTPS:
git clone https://github.com/xxx/xxx.git
- Clone with SSH:
git clone git@github.com:xxx/xxx.git
If you don't set up a proxy for local SSH, cloning using SSH will not take the proxy.
If you want to use the socks5 proxy, you only need one command
git config --global HTTP.proxy socks5://your-server:your-port
Unset proxy:
git config --global --unset http.proxy
It works in my Ubuntu 16.04.
thx you so much the ,my machine is run also,iam not set SSH
thx you so much the ,my machine is run also,iam not set SSH |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This post helps a lot, thx everyone! :) |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
yangxuanx
on 9 Oct 2019
针对archlinux 默认没有安装netcat,仓库有两个netcat,gnu和openbsd,装openbsd-netcat,就对了
sudo pacman -S openbsd-netcat
针对archlinux 默认没有安装netcat,仓库有两个netcat,gnu和openbsd,装openbsd-netcat,就对了 sudo pacman -S openbsd-netcat |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
alancprc
on 15 Oct 2019
针对archlinux 默认没有安装netcat,仓库有两个netcat,gnu和openbsd,装openbsd-netcat,就对了
sudo pacman -S openbsd-netcat
thanks!
thanks! |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
baddate
on 15 Oct 2019
git 是没有 https 这个 config section 的
如果想要使用SOCKS5代理的话只需要
git config --global http.proxy "socks5h://your_addr:your_port"
即可
为什么我这样设置,git push还是很慢啊
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
LittleBreak
on 18 Oct 2019
使用git@github.com:xxx.git clone时,提示
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
应该怎么解决啊
使用git@github.com:xxx.git clone时,提示
应该怎么解决啊 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
shouyong
on 21 Oct 2019
使用git@github.com:xxx.git clone时,提示
Host key verification failed. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
应该怎么解决啊
换成https开头的地址;
换成https开头的地址; |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
thanks |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
sanjayzzzhong
on 24 Oct 2019
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'
thanks
thanks |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
yanxijian
on 6 Nov 2019
补充两点:
1, https.proxy设置是无用的, 只需要设置http.proxy
2, socks5h://更好, 远端DNS
- 确实设置http.proxy就可以了 (git config --global https.proxy http://127.0.0.1:1080)
- 我这里设置socks5时,push会提示:The ServicePointManager does not support proxies with the socks5 scheme. 需要输入账号和密码才能push
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
git config --global http.https://github.com.proxy socks5://127.0.0.1:1080 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
sanjayzzzhong
on 13 Nov 2019
我个人觉得不需要单独配置git的代理, 因为之前这样子配导致我的mac上用brew总是走代理, 找了好久才发现问题
因此我个人推荐每开一终端, 需要用到代理的时候再打开终端并输入一下shell语句:
# 如果你的代理走的是sock5 用这个
export ALL_PROXY=socks5://127.0.0.1:1080
或者
# 如果你的代理走的是http 用这个
export ALL_PROXY=http://127.0.0.1:1080
这样的配置仅针对当前终端, 如果新开一个终端就没有走代理.
单独为git设置代理的话, 会在git的配置文件里添加代理, 有时候难以定位错误.
希望我的建议能够帮助到各位~
我个人觉得不需要单独配置git的代理, 因为之前这样子配导致我的mac上用brew总是走代理, 找了好久才发现问题 # 如果你的代理走的是sock5 用这个
export ALL_PROXY=socks5://127.0.0.1:1080 或者 # 如果你的代理走的是http 用这个
export ALL_PROXY=http://127.0.0.1:1080 这样的配置仅针对当前终端, 如果新开一个终端就没有走代理. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
nepaul
on 13 Nov 2019
我个人觉得不需要单独配置git的代理, 因为之前这样子配导致我的mac上用brew总是走代理, 找了好久才发现问题
因此我个人推荐每开一终端, 需要用到代理的时候再打开终端并输入一下shell语句:# 如果你的代理走的是sock5 用这个 export ALL_PROXY=socks5://127.0.0.1:1080或者
# 如果你的代理走的是http 用这个 export ALL_PROXY=http://127.0.0.1:1080这样的配置仅针对当前终端, 如果新开一个终端就没有走代理.
单独为git设置代理的话, 会在git的配置文件里添加代理, 有时候难以定位错误.
希望我的建议能够帮助到各位~
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
打开自己的ss客户端,看下http代理的端口,我的1087并不是1080,别被误导了 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
yangruihan
on 22 Nov 2019
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'
为什么要加引号呢,我加了引号反而有问题,去掉引号成功了
为什么要加引号呢,我加了引号反而有问题,去掉引号成功了 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
HarborZeng
on 7 Dec 2019
@zhangle1 使用 git@xxoo.com 这种方式,是用的 SSH 协议。需要在 ~/.ssh/config 目录下配置
Host xxoo.com(改成你的站点)
ProxyCommand connect -H 127.0.0.1:1080 %h %p
谢谢 可以用于windows10
谢谢 可以用于windows10 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
HarborZeng
on 7 Dec 2019
For those who use linux system like centos, debian or deepin, if there are problems with nc -X
, you can chose connect-proxy
, intorduced https://stackoverflow.com/questions/19161960/connect-with-ssh-through-a-proxy。
Just use
$ sudo apt install connect-proxy -y
and then edit your ~/.ssh/config
as following:
Host github.com
User git
ProxyCommand connect-proxy -S 127.0.0.1:1080 %h %p
For those who use linux system like centos, debian or deepin, if there are problems with Just use $ sudo apt install connect-proxy -y and then edit your
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
iSteveyang
on 21 Dec 2019
git config --global http.https://github.com.proxy socks5://127.0.0.1:
大佬NB
大佬NB |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
liuzhenyulive
on 28 Dec 2019
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'
如果这样用不了 可以试试把引号去掉,即
git config --global http.proxy socks5://127.0.0.1:1080
git config --global https.proxy socks5://127.0.0.1:1080
如果这样用不了 可以试试把引号去掉,即
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
E1sewhere
on 26 Jan 2020
我也是,win10,本地使用的v2ray做代理:socks5端口维1079,http端口为1080,
为git设置了代理
git config --global http.proxy http://127.0.0.1:1080
git config --global https.proxy http://127.0.0.1:1080
然后又在gitconfig
里查看,确实把代理添加好了.
git里使用命令
curl www.google.com
timeout,同时监听代理完全没有对google的请求,基本可以断定git的请求没有走代理.
用同样的方法在cmd里设置了代理,cmd可以成功访问到google.
不知道我是什么问题,我也在.ssh
内添加了config文件并按评论设置了内容,依然timeout.
我也是,win10,本地使用的v2ray做代理:socks5端口维1079,http端口为1080,
然后又在
timeout,同时监听代理完全没有对google的请求,基本可以断定git的请求没有走代理. 不知道我是什么问题,我也在 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
sanjayzzzhong
on 26 Jan 2020
我也是,win10,本地使用的v2ray做代理:socks5端口维1079,http端口为1080,
为git设置了代理
git config --global http.proxy http://127.0.0.1:1080
git config --global https.proxy http://127.0.0.1:1080
然后又在
gitconfig
里查看,确实把代理添加好了.
git里使用命令curl www.google.com
timeout,同时监听代理完全没有对google的请求,基本可以断定git的请求没有走代理.
用同样的方法在cmd里设置了代理,cmd可以成功访问到google.不知道我是什么问题,我也在
.ssh
内添加了config文件并按评论设置了内容,依然timeout.
在git里使用命令,是指用win10下的git bash那个终端吗?还是指什么?
在git里使用命令,是指用win10下的git bash那个终端吗?还是指什么? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
E1sewhere
on 29 Jan 2020
我也是,win10,本地使用的v2ray做代理:socks5端口维1079,http端口为1080,
为git设置了代理
git config --global http.proxy http://127.0.0.1:1080
git config --global https.proxy http://127.0.0.1:1080
然后又在
gitconfig
里查看,确实把代理添加好了.
git里使用命令curl www.google.com
timeout,同时监听代理完全没有对google的请求,基本可以断定git的请求没有走代理.
用同样的方法在cmd里设置了代理,cmd可以成功访问到google.
不知道我是什么问题,我也在.ssh
内添加了config文件并按评论设置了内容,依然timeout.在git里使用命令,是指用win10下的git bash那个终端吗?还是指什么?
git bash,已经解决,换了shocks协议,可以连上github了
git bash,已经解决,换了shocks协议,可以连上github了 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Atuna
on 17 Feb 2020
结合以上各位经验设置成功. 以下以macOS为准.
https访问
仅为github.com设置socks5代理(推荐这种方式, 公司内网就不用设代理了, 多此一举):
git config --global http.https://github.com.proxy socks5://127.0.0.1:1086
其中1086是socks5的监听端口, 这个可以配置的, 每个人不同, 在macOS上一般为1086.
设置完成后, ~/.gitconfig文件中会增加以下条目:[http "https://github.com"] proxy = socks5://127.0.0.1:1086
ssh访问
需要修改~/.ssh/config文件, 没有的话新建一个. 同样仅为github.com设置代理:Host github.com User git ProxyCommand nc -v -x 127.0.0.1:1086 %h %p
如果是在Windows下, 则需要个性%home%.ssh\config, 其中内容类似于:
Host github.com User git ProxyCommand connect -S 127.0.0.1:1086 %h %p
这里-S表示使用socks5代理, 如果是http代理则为-H. connect工具git自带, 在\mingw64\bin\下面.
总结的很好,已经成功了,感谢!
我是用的git clone git@github.com/xxx,实际生效的命令是:
Host github.com User git ProxyCommand connect -S 127.0.0.1:1086 %h %p
没有测试过但git clone https://github.com/xxx,的话应该是需要:
git config --global http.https://github.com.proxy socks5://127.0.0.1:1086
总结的很好,已经成功了,感谢!
没有测试过但git clone https://github.com/xxx,的话应该是需要:
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
liuweiGL
on 4 Mar 2020
在windows上,在Git Bash里设置
ProxyCommand nc -X 5 -x 127.0.0.1:1080 %h %p
会报错的,提示:
/usr/bin/bash: line 0: exec: nc: not found
因为这个bash是不带netcat的,也就找到不到nc命令。
在win10上,有的msysgit版本集成了connect工具,所以在windows上,可以把ssh的config文件设置为:Host github.com ProxyCommand connect -S 127.0.0.1:1080 %h %p
就可以给ssh加socks代理了。
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
用proxychains呢 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
http/https不行的,记得确认一下本地代理工具有没有打开http代理 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
weaming
on 20 Mar 2020
基于Trojan的代理需要双引号,git config --global http.proxy "socks5://127.0.0.1:1080"
说不通,这个配置是在ssh这边的,跟使用ss还是trojan没有关系
说不通,这个配置是在ssh这边的,跟使用ss还是trojan没有关系 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
1725636955
on 20 Mar 2020
基于Trojan的代理需要双引号,git config --global http.proxy“ socks5://127.0.0.1:1080”
说不通,这个配置是在ssh这边的,跟使用ss还是trojan没有关系
单引号不行,
单引号不行, |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
亲测:git config --global http.proxy 'http://127.0.0.1:1080' |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Hunu
on 28 Mar 2020
ProxyCommand nc -X 5 -x 127.0.0.1:1080 %h %p
太NB了,smarxpan 大神的方法解决了我数年的困扰!
git clone with ssh using Socks5 proxy: 亲测有效
太NB了,smarxpan 大神的方法解决了我数年的困扰! git clone with ssh using Socks5 proxy: 亲测有效 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
OsbertWang
on 25 Apr 2020
仿照上面的内容写了以下配置方案,操作系统是 win 10,代理用 SSR,端口 1080。
先设置了
git config --global http.https://github.com.proxy socks5h://127.0.0.1:1080
接着用
git config --global --get http.https://github.com.proxy
得到反馈
socks5h://127.0.0.1:1080
说明设置成功。
下面在用户文件夹的 .ssh 中建立 config 文件,内容为
ProxyCommand connect -S 127.0.0.1:1080 -a none %h %p
Host github.com
User git
Port 22
Hostname github.com
IdentityFile "C:\Users\****\.ssh\id_rsa"
TCPKeepAlive yes
ServerAliveInterval 600
IPQoS=throughput
ServerAliveCountMax 120
Host ssh.github.com
User git
Port 443
Hostname ssh.github.com
IdentityFile "C:\Users\****\.ssh\id_rsa"
TCPKeepAlive yes
ServerAliveInterval 600
IPQoS=throughput
ServerAliveCountMax 120
仿照上面的内容写了以下配置方案,操作系统是 win 10,代理用 SSR,端口 1080。
接着用
得到反馈
说明设置成功。
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
thx v m |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
pcqpcq
on 11 May 2020
just
git config --global http.proxy 127.0.0.1:1080
git config --global https.proxy 127.0.0.1:1080
without http://
or https://
just
without |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
thx |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Jade-Zeng
on 14 Jun 2020
git config --global http.proxy http://127.0.0.1:网络设置里的端口号
git config --global https.proxy https://127.0.0.1:网络设置里的端口号
git config --global --unset http.proxy
git config --global --unset https.proxy
后面的端口号是你电脑走代理之后,在网络设置里的代理的端口号,在电脑的网络设置高级代理里点击http 或 https查看
git config --global http.proxy http://127.0.0.1:网络设置里的端口号 git config --global https.proxy https://127.0.0.1:网络设置里的端口号 git config --global --unset http.proxy git config --global --unset https.proxy |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
liuqinh2s
on 18 Jun 2020
git config --local https.proxy https://127.0.0.1:1080 我这样配置有什么问题么?为什么还是没走ss代理呢?
因为git没有https.proxy这个选项,只有http.proxy,设置了这个,https流量也会走代理
因为git没有https.proxy这个选项,只有http.proxy,设置了这个,https流量也会走代理 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
HarborZeng
on 19 Jun 2020
仿照上面的内容写了以下配置方案,操作系统是 win 10,代理用 SSR,端口 1080。
先设置了git config --global http.https://github.com.proxy socks5h://127.0.0.1:1080
接着用
git config --global --get http.https://github.com.proxy
得到反馈
socks5h://127.0.0.1:1080
说明设置成功。
下面在用户文件夹的 .ssh 中建立 config 文件,内容为ProxyCommand connect -S 127.0.0.1:1080 -a none %h %p Host github.com User git Port 22 Hostname github.com IdentityFile "C:\Users\****\.ssh\id_rsa" TCPKeepAlive yes ServerAliveInterval 600 IPQoS=throughput ServerAliveCountMax 120 Host ssh.github.com User git Port 443 Hostname ssh.github.com IdentityFile "C:\Users\****\.ssh\id_rsa" TCPKeepAlive yes ServerAliveInterval 600 IPQoS=throughput ServerAliveCountMax 120
感谢 这个真的有用
感谢 这个真的有用 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
bao3
on 20 Jun 2020
我无意间搜到这个,我是想说,我没有设置 git 单独的代理,而是设置 shell 的代理,这样就自动解决了 git / apt /yum 所有这些的网速问题。
另外如果使用 docker,可以通过添加 -e http_proxy=****
-e https_poryx=***
来让 docker 特定容器支持代理。
我无意间搜到这个,我是想说,我没有设置 git 单独的代理,而是设置 shell 的代理,这样就自动解决了 git / apt /yum 所有这些的网速问题。 另外如果使用 docker,可以通过添加 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ghosoft
on 27 Jun 2020
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'
works for me, Thank you!
works for me, Thank you! |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
good,Thanks |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
han88829
on 20 Jul 2020
[remote "origin"] proxy = socks5://127.0.0.1:1080
我使用v2ray,以上设置对我无用,直接修改proxy可以
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Jason-Ma-233
on 21 Jul 2020
git最近更新了socks5的语法,去掉了引号,git config --global http.proxy socks5://127.0.0.1:10808
配合V2RayN可用
git最近更新了socks5的语法,去掉了引号, |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
HStarrr
on 30 Jul 2020
在windows上,在Git Bash里设置
ProxyCommand nc -X 5 -x 127.0.0.1:1080 %h %p
会报错的,提示:
/usr/bin/bash: line 0: exec: nc: not found
因为这个bash是不带netcat的,也就找到不到nc命令。
在win10上,有的msysgit版本集成了connect工具,所以在windows上,可以把ssh的config文件设置为:Host github.com ProxyCommand connect -S 127.0.0.1:1080 %h %p
就可以给ssh加socks代理了。
非常棒!这才是正确答案!!!
非常棒!这才是正确答案!!! |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
方法管用,就是端口必须改成跟ShadowSocks的Socks5端口一致 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ijpq
on 11 Sep 2020
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'
work
work |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
forliuyifei
on 25 Sep 2020
仿照上面的内容写了以下配置方案,操作系统是 win 10,代理用 SSR,端口 1080。
先设置了git config --global http.https://github.com.proxy socks5h://127.0.0.1:1080
接着用
git config --global --get http.https://github.com.proxy
得到反馈
socks5h://127.0.0.1:1080
说明设置成功。
下面在用户文件夹的 .ssh 中建立 config 文件,内容为ProxyCommand connect -S 127.0.0.1:1080 -a none %h %p Host github.com User git Port 22 Hostname github.com IdentityFile "C:\Users\****\.ssh\id_rsa" TCPKeepAlive yes ServerAliveInterval 600 IPQoS=throughput ServerAliveCountMax 120 Host ssh.github.com User git Port 443 Hostname ssh.github.com IdentityFile "C:\Users\****\.ssh\id_rsa" TCPKeepAlive yes ServerAliveInterval 600 IPQoS=throughput ServerAliveCountMax 120
显示:
socks5h://127.0.0.1:1080
可还是特别慢, 开了全局ssr, 端口也是1080
显示:
可还是特别慢, 开了全局ssr, 端口也是1080 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
https是没用的,无论复制的地址有没有SSL加密,改http.proxy就行了。顺便蹲一个办法,有没有办法只设置单次clone使用代理? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
感觉没上网工具的日子会越来越难过 git 走 Clash 代理设置 npm 强制走 Clash 代理 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
为什么设置成这样的代理就能加速啊,这是什么原理? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
aszswaz
on 27 Nov 2020
请问一下,我只设置了git config --global https而没设置git config --global http的时候,clone一个google的git仓库依然不行,后来加上了http的设置才可以,我也是ss代理代理都和你们一样,有人知道这是为什么吗?我的clone仓库url是https的啊,但还是需要把http和https代理都挂上才可以吗?
没有单独的https代理协议,https也是属于http的代理协议的一部分
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Ron2014
on 17 Feb
在windows上,在Git Bash里设置
ProxyCommand nc -X 5 -x 127.0.0.1:1080 %h %p
会报错的,提示:
/usr/bin/bash: line 0: exec: nc: not found
因为这个bash是不带netcat的,也就找到不到nc命令。
在win10上,有的msysgit版本集成了connect工具,所以在windows上,可以把ssh的config文件设置为:Host github.com ProxyCommand connect -S 127.0.0.1:1080 %h %p
就可以给ssh加socks代理了。
I have done with these in ~/.ssh/config
Host github.com
HostName github.com
User git
# socks5 need: pacman -S mingw-w64-x86_64-connect mingw-w64-i686-connect
ProxyCommand connect -S 127.0.0.1:2801 %h %p
Thanks you all..
$ git clone git@github.com:testerSunShine/12306.git
Cloning into '12306'...
remote: Enumerating objects: 2730, done.
fatal: index-pack failed(468/2730), 8.00 MiB | 3.82 MiB/s
client_loop: send disconnect: Broken pipe
fetch-pack: unexpected disconnect while reading sideband packet
I have done with these in ~/.ssh/config
Thanks you all..
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Thanks, it helps. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
is slower |
git config --local https.proxy https://127.0.0.1:1080 我这样配置有什么问题么?为什么还是没走ss代理呢?