【问题标题】:remote: Forbidden fatal: unable to access远程:禁止致命:无法访问
【发布时间】:2019-11-10 16:33:24
【问题描述】:

我可以访问 repo,我通过 https 克隆它,然后我进行了更改并提交了这些更改并创建了 new_branch 并尝试推送我得到了这个:

git push origin new_branch
remote: Forbidden
fatal: unable to access 'https://username@bitbucket.org/main-account/repo.git/': The requested URL returned error: 403

我已经设置了我的 SSH 密钥、git global config 并且已经登录

ssh -T username@bitbucket.org
logged in as username

You can use git or hg to connect to Bitbucket. Shell access is disabled

另外,我尝试更改网址

git remote set-url origin git@bitbucket.org:main-account/repo.git

当我推动时,我得到了这个

git push origin new_branch
Forbidden
fatal: Could not read from remote repository.

Please make sure you have the correct access rights

最后是我的~/.ssh/config

Host *
        UseKeychain yes

Host bitbucket.org
        HostName bitbucket.org
        PreferredAuthentications publickey
        IdentityFile ~/.ssh/id_rsa

有什么帮助吗? 在此先感谢

【问题讨论】:

  • git remote show origin 说什么?
  • 鉴于您从 HTTPS 和 SSH 收到“禁止”访问错误,您确定您可以访问该存储库吗?也许您只有只读访问权限:您可以git fetch 吗? (我猜不是这样 - SSH 错误显示“读取”。)你确定有正确的路径吗?
  • @Christoph 在这里查看:codepile.net/pile/KxgbE5jP
  • 您是否启用了 2FA(2 因子身份验证)?我使用 github,启用 2FA 时我必须创建访问密钥,常规用户名密码或 ssh 密钥不适用于 2FA。
  • 不,我没有启用它@MohanaRao

标签: git macos bitbucket


【解决方案1】:

确保usernamemain-account 相同:您需要推送回您拥有的存储库(已创建为用户名)

或者您需要拥有been granted repository accessusername 的所有者main-account

【讨论】:

    【解决方案2】:

    确保您可以访问 Bitbucket。

    要检查,您可以:登录 Bitbucket > 个人资料和设置 > 个人设置 > 应用密码 > 选择/授予所需的访问权限。

    【讨论】:

      【解决方案3】:

      要检查,您可以:登录 Bitbucket > 个人资料和设置 > 个人设置 > 应用密码 > 选择/授予所需的访问权限。 > 将为您生成一个令牌。记下这一点,并在您将代码上传/推送到 bitbucket 时使用它。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-10-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-06-06
        相关资源
        最近更新 更多