git - 使用 Google Code 项目验证 SourceTree

标签 git authentication google-code atlassian-sourcetree

我正在尝试使用最新版本 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://USER@code.google.com/p/PROJECT/

使用:

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

有关详细信息,请参阅:https://answers.atlassian.com/questions/36585/entering-in-a-password-in-sourcetree

关于git - 使用 Google Code 项目验证 SourceTree,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9344566/

相关文章:

git - 更改 git 提交历史记录但保留更改

git - 如何将 git clone 变成一个 fork,然后从 fork 推送到 heroku?

git - 为每个 git repo 配置 ssh key

azure - Azure 中的用户身份

c# - 使用 Azure AD 的用户管理器

wiki - 如何将某个页面设置为 Google 代码上的默认 wiki 页面?

sql-server - 将 Azure SQL 数据库置于 Git 版本控制之下

node.js - 使用新的用户名和密码更新 vsts-npm-auth

mercurial - 在将Mercurial提交给Google Code时获取 "nothing changed"

google-code - 谷歌代码上是否有我所有代码项目的概述?