【问题标题】:git is prompting me for someone elses password when I try to push当我尝试推送时,git 提示我输入其他人的密码
【发布时间】:2018-12-25 01:35:53
【问题描述】:

我正在尝试对我正在编辑的一个大型项目进行初步推送(我不是原作者),当我去推送项目时,我的 github 存储库它要求我在 bitbucket 上输入其他人的密码? ??

我尝试在 github 上创建一个新帐户并重置全局用户名/密码,删除 keychain 上与 git 相关的所有文件并尝试更改目录名称。

项目名称 darrinwebster$ git push -u origin master

“otherPersonsBitbucketAccount.org”的密码:

远程:用户名或密码无效

致命:“otherPersonsBitbucketAccount.org”的身份验证失败

我希望 git 询问我的凭据(对于 github),因为我已将存储库来源设置为我的帐户。

【问题讨论】:

  • 该项目的 .gitconfig 的 [user] 块中有什么内容?
  • user.name=Darrin Webster 但我刚刚注意到远程 url 设置为 otherPersonsBitbucketAccount.org 如果可能,我将如何具体更改该属性?
  • @jmargolisvt:user.nameuser.email 设置仅用于提交,不用于身份验证。 @DarrinWebster:身份验证方法取决于 URL(https 与 ssh)和任何特定于操作系统的 ssh 或 https 身份验证处理,以及您可能指示 Git 使用的任何凭据缓存。
  • 那么您是说不可能更改原始 URL 吗?对不起,这真的让我很困惑
  • 您使用的是什么网址?当然可以改变它;这只是一个设置。

标签: git github


【解决方案1】:

您可能希望重置您的origin 远程 URL 以指向您的 GitHub 帐户,而不是其他人的 Bitbucket 帐户。您可以通过以下方式执行此操作:

git remote set-url origin https://github.com/example-user/example-repo.git

如果您愿意,也可以使用 SSH URL:

git remote set-url origin git@github.com:example-user/example-repo.git

如果你愿意,你可以添加一个不同的遥控器,然后推送到那个遥控器:

git remote add github https://github.com/example-user/example-repo.git
git push -u github master

您当然可以使用您控制的任何 URL;如果您想使用 Bitbucket 帐户而不是 GitHub 帐户,那很好。

【讨论】:

    【解决方案2】:

    Git 从 git config 获取用户名 所以我将从检查 git config (git config --global user.name) 中的用户名开始。 如果是问题,您可以使用 git config --global user.name "John Doe" 更改用户名

    【讨论】:

    • “我已经尝试在 github 上创建一个新帐户并重置全局用户名/密码”是否可以更改配置的 remote.origin.url 块?
    • 仓库是私有的?第二个选项(如果您认为 get 配置是正确的)您需要在 github 中检查您的权限(gitlab?不确定您使用的是什么)?
    • user.nameuser.email 与身份验证无关。它们被复制到提交以设置提交作者身份,仅此而已。
    猜你喜欢
    • 1970-01-01
    • 2013-09-01
    • 2011-12-08
    • 1970-01-01
    • 2017-05-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多