2016-06-23 97 views
2

因此,我在另一臺機器上設置了回購設置。我已經提交併推送了文件,並且他們在github.com上查看的很好。現在,我在另一臺機器上運行了git init,我試圖拉。請求的URL返回錯誤:403訪問github.com時禁止訪問

# git remote set-url origin [email protected]:me/someproj.git 
fatal: No such remote 'origin' 

# git remote add origin https://github.com/me/someproj.git 

# git pull 
error: The requested URL returned error: 403 Forbidden while accessing https://github.com/me/someproj.git/info/refs 

fatal: HTTP request failed 

# git remote -v 
origin https://github.com/me/someproj.git (fetch) 
origin https://github.com/me/someproj.git (push) 

# git pull origin 
error: The requested URL returned error: 403 Forbidden while accessing https://github.com/me/someproj.git/info/refs 

fatal: HTTP request failed 
+0

請提供更多信息 - 您在該機器上使用哪個git版本?你設置了用戶名和密碼嗎?你是在防火牆後還是使用代理? –

+0

git版本1.7.1,不,我不支持代理,我知道。我不確定我是否設置了用戶/密碼。 – User

+0

所以這可能是你的問題,用'''git config --global user.name your_username'''設置它,併爲你的密碼做同樣的事情。 –

回答

7

你需要檢查你正在使用的機器,其中一推到GitHub的成功是什麼憑據(用戶名/密碼),並在新的本地回購重新使用這些憑據。

特別檢查使用的網址類型:ssh([email protected]:me/someproj.git)或https(https://github.com/me/someproj.git)。
檢查您是否爲using 2FA (Two-Factor Authentication)或不是該GitHub帳戶和回購。

您可以嵌入right username in your url ::

cd /path/to/new/local/repo 
git remote add origin https://[email protected]/me/someproj.git 
0

當試圖從你會發現其中有403個狀態碼相關的下列消息瀏覽器訪問https://github.com/me/someproj.git/info/refs

Please upgrade your git client. GitHub.com no longer supports git over dumb-http: https://github.com/blog/809-git-dumb-http-transport-to-be-turned-off-in-90-days

如果您正在使用1.6.6之前的git,嘗試更新它或更好地使用SSH協議。

同時檢查您的設置與git config --global user.namegit config --global user.password

相關問題