【发布时间】: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