2017-09-22 98 views
-1

我可以將我的項目添加到一個github帳戶,但與另一個帳戶,我不能。我跟着這個網站的GitHub和工作得很好:https://www.londonappdeveloper.com/how-to-use-git-hub-with-android-studio/#comment-32683不能從android工作室推入github

步驟是:1.創建一個新的git回購。 2.從android studio- VCS>導入到版本控制>創建git回購。 3.在項目的打開bash命令的窗口根目錄下鍵入> git remote add origin https://github.com/xxx/myProject.git 4.然後返回到android studio並a)project> git> add b)project> Git> Commit c)project> Git> repository> push

這些步驟工作正常,我得到一個成功的消息使用一個github帳戶。但與其他帳戶,我不能這樣做,我得到的埃羅:

Failed with error: fatal: unable to access 'https://github.com/Rashedul/myProject.git/': The requested URL returned error: 403 

爲什麼會出現這種情況,如何解決呢?

+0

可能重複[推送到Git返回錯誤代碼403致命:HTTP請求失敗](https://stackoverflow.com/questions/7438313/pushing-to-git-returning-error-code-403-fatal-http -請求失敗) – phd

回答

0

首先你應該設置用戶名和密碼來訪問URL並登錄,首先設置Authentication。

git remote set-url origin https://[email protected]/user/repo.git 

然後你就會想git push

這是在HTTP認證格式時會要求輸入密碼。你可以設置密碼,也:

https://youruser:[email protected]/user/repo.git 

你應該知道,如果你這樣做,你的github上的密碼將被存儲在純在你的.git目錄,這顯然是不可取的。