依赖使用ssh拉取仓库,报错内容:

npm ERR! Error while executing:
npm ERR! C:\Program Files\Git\cmd\git.EXE ls-remote -h -t ssh://git@github.com/seonim-ryu/Squire.git
npm ERR!
npm ERR! ssh: connect to host github.com port 22: Connection timed out
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR! exited with error code: 128

解决方式Git增加配置替换对应的协议

git config --global url."https://github.com/".insteadOf "ssh://git@github.com/"
git config --global url."https://".insteadOf git://

拉取GitHub仓库的代码无法建立连接,报错内容:

npm ERR! Error while executing:
npm ERR! C:\Program Files\Git\cmd\git.EXE ls-remote -h -t ssh://git@github.com/seonim-ryu/Squire.git
npm ERR!
npm ERR! fatal: unable to access 'https://github.com/seonim-ryu/Squire.git/': Failed to connect to github.com port 443 after 21087 ms: Couldn't connect to server
npm ERR!
npm ERR! exited with error code: 128

查看git配置(两种)

git config  --list
git config --global --list

解决方式挂代理:

http方式

git config --global http.proxy "http://127.0.0.1:8080"
git config --global https.proxy "http://127.0.0.1:8080"

socks5方式

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 --unset http.proxy
git config --global --unset https.proxy