1. 程式人生 > >Git錯誤fatal: unable to access 'https://github.com/****.git/': Couldn't resolve host 'github.com'

Git錯誤fatal: unable to access 'https://github.com/****.git/': Couldn't resolve host 'github.com'

今天對github上的專案進行git pull的時候出現了錯誤:

fatal: unable to access 'https://github.com/****.git/: Couldn't resolve host 'github.com'

這裡的**.git是假設我的github專案地址。我記得前些天git突然提示我重新輸入使用者名稱和密碼,當時使用者名稱輸入錯了,連線remote驗證失敗,這應該就是原因。
百度了一下解決辦法,試了都沒什麼雞蛋用,但是每個人情況都不一樣,我這裡貼出來是因為對於你可能是有用的(你就是它的命中註定^^):
如什麼
1.重設賬號密碼的:

(1)先重新設定本機git配置:git config --global credential.helper store

(2)輸入github賬號和密碼

(3)最後push程式碼:git push -u origin master

2.重置git配置的http或https代理的:

http version:

git config --global --unset http.proxy

https version:

git config --global --unset https.proxy

最後我想,反正我是pull程式碼,直接重新新增遠端的分支就好了,於是:

(1)移除本地分支:git remote rm origin
(2)新增遠端分支:git remote add origin 'https://github.com/***.git'


(3)然後:git pull即可