对于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.