首页 > 其他 > 详细

git设置代理

时间:2019-04-19 12:06:36      阅读:171      评论:0      收藏:0      [点我收藏+]
对于github初学者,刚配置的环境可能会遇到各种坑,比如如果本地电脑使用的是公司网络,那有可能按照正常操作:去github上clone一个project的时候,就会提示

C:\myproject\vue01>git clone https://github.com/hemiahwu/vue-basic.git
Cloning into ‘vue-basic‘...
fatal: unable to access ‘https://github.com/hemiahwu/vue-basic.git/‘: Couldn‘t resolve host ‘github.com‘

明明浏览器可以访问,但是为什么用git clone命令就是不行了呢。这个时候就有可能是因为本地电脑上有设置proxy,现在只需要配置一下git的proxy就可以了。打开CMD,按照以下格式输入,按回车,如果没有报错,应该就是设置好了。

git config --global https.proxy https://user:password@address:port

再试一下git clone,就可以正常运行了。

C:\myproject\vue01>git config --global http.proxy http://username:password@proxyserverhostname:port

C:\myproject\vue01>git clone https://github.com/hemiahwu/vue-basic.git
Cloning into ‘vue-basic‘...
remote: Enumerating objects: 151, done.
remote: Total 151 (delta 0), reused 0 (delta 0), pack-reused 151
Receiving objects: 100% (151/151), 47.54 KiB | 0 bytes/s, done.
Resolving deltas: 100% (58/58), done.

git设置代理

原文:https://blog.51cto.com/jiaszwx/2381207

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!