網(wǎng)站建設(shè)高端crm網(wǎng)站
最近GitHub訪問越來越不穩(wěn)定,經(jīng)常提示無法訪問此網(wǎng)站。
一個解決辦法是使用?https://github.com/521xueweihan/GitHub520
這個項目提供的hosts文件,內(nèi)容會定時更新,Windows 系統(tǒng)保存在文件C:\Windows\System32\drivers\etc\hosts
推薦https://github.com/oldj/SwitchHosts 這個工具管理hosts。
訪問GitHub解決后再說git pull和Git push失敗的問題。
Connection reset by 20.205.243.160 port 22
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
可能在出口屏蔽了22端口,github允許你使用443端口進行ssh連接,因為443端口是訪問https網(wǎng)站所必須的。
首先生成指定名字的密鑰, ssh-keygen -t rsa -C "郵箱地址" -f ~/.ssh/github_sushengbuhuo 會生成 github_sushengbuhuo 和 github_sushengbuhuo.pub 這兩個文件。
?打開公鑰文件~/.ssh/github_sushengbuhuo.pub?,并把內(nèi)容復(fù)制至代碼托管平臺上?https://github.com/settings/keys ,添加成功。
修改config文件 vim ~/.ssh/config ?,如果沒有創(chuàng)建 config,這里7890是代理端口。
Host sushengbuhuo.github.com
Hostname ssh.github.com
Port 443
User git
ProxyCommand connect -H 127.0.0.1:7890 %h %p
IdentityFile ~/.ssh/github_sushengbuhuo
測試下連接成功 ssh -T git@github.com
Hi sushengbuhuo! You've successfully authenticated, but GitHub does not provide shell access.?
然后使用ssh拉取代碼?
git clone git@github.com:521xueweihan/GitHub520.git
?github 上選擇clone地址時,選擇ssh地址, 這樣git push 與 git clone 都可以直接走代理了,不需要輸入密碼。
這里使用的命令行工具是git bash。
這里順便推薦個油猴腳本https://github.com/XIU2/UserScript
方便下載GitHub文件。