我正在尝试使用最新版本 SourceTree与使用 Git 的 Google 代码项目。问题是当我尝试推送更改时,它会提示身份验证:
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 选项,但我找不到了。我发现唯一允许您输入类似内容的地方是存储库的高级选项卡或主要首选项的常规选项卡。但是,在这两种情况下,它只要求提供电子邮件地址而不是密码。
最佳答案
问题是默认情况下 Google 会告诉(在 .git/config
中)您使用包含“USER@”部分的 URL。 SourceTree 看到这一点并假定用户名是 URL 中的用户并且没有密码。要解决此问题,只需删除 URL 中的“USER@”部分即可。然后,当您尝试推送更改时,SourceTree 将提示您输入用户名/密码。
例如,代替:
使用:
有关详细信息,请参阅:https://answers.atlassian.com/questions/36585/entering-in-a-password-in-sourcetree
关于git - 使用 Google Code 项目验证 SourceTree,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9344566/