2012-02-18 81 views
3

我正在嘗試將最新版本SourceTree與使用Git的Google Code項目結合使用。問題是,當我嘗試推的變化,它抱怨認證:使用Google Code項目對SourceTree進行身份驗證

git push -v --tags --set-upstream origin master:master
Pushing to [project]
fatal: remote error: Invalid username/password.
You may need to use your generated googlecode.com password; see https://code.google.com/hosting/settings
Completed with errors, see above

我看不到在密碼在設置任何地方進入的地方。我試圖搜索Atlassain's knowledge base和谷歌,但我找不到任何相關的東西。唯一的線索是來自谷歌的項目網頁,其中說:

Option 1: Get a local copy of the [project] repository with this command:
git clone [project]
To push your changes, authenticate with your Google Account and your generated googlecode.com password.
Option 2: Stay authenticated with .netrc:
Add the following to your .netrc.
machine code.google.com login [email] password [generated googlecode.com password]
Make sure the clone URL doesn't contain your username: git clone [url]

還有another Google page它說:

For Git repositories, you can add the following line to your .netrc file recording your password for each repository domain you have commit access to. Make sure you have set the permissions on .netrc so that only your user account can read it.

machine code.google.com login [email] password [password]

後我升級到SourceTree的最新版本,此問題纔開始。在GUI中可以輸入認證詳細信息嗎?我相信舊版本中有一個GUI選項,但我找不到它了。我發現的唯一可以讓您輸入類似內容的地方位於存儲庫的高級選項卡或主要首選項的常規選項卡中。但是,在這兩種情況下,它只需要一個電子郵件地址而不是密碼。

回答

14

問題是,谷歌默認告訴(在.git/config)你使用的URL包含「USER @」部分。 SourceTree看到這一點,並假定用戶名是URL中的用戶,並且沒有密碼。要解決這個問題,只需刪除URL中的「USER @」部分即可。然後,當您嘗試推送更改時,SourceTree會提示輸入用戶名/密碼。

例如,而不是:

https://[email protected]/p/PROJECT/

使用:

https://code.google.com/p/PROJECT/

欲瞭解更多信息,請參見:https://answers.atlassian.com/questions/36585/entering-in-a-password-in-sourcetree

+0

是有一個很好的理由,這是默認的行爲? – 2013-05-18 09:55:29