远程:禁止访问 致命错误:无法访问

4

我可以访问仓库,通过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并登录。
ssh -T username@bitbucket.org
logged in as username

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

此外,我尝试更改URL。

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

需要帮忙吗? 提前感谢。


1
由于HTTPS和SSH都出现了“Forbidden”访问错误,您确定您有权限访问该仓库吗?也许您只有只读权限:您可以尝试git fetch命令吗?(我猜这不是问题所在 - SSH错误提示为“read”)。您确定路径正确吗? - Rup
@Christoph 点这里查看:https://www.codepile.net/pile/KxgbE5jP - Fathi
我没有启用它@MohanaRao - Fathi
那个仓库有IP限制吗?拥有该仓库的团队会设置这些限制。 - Jim Redmond
你使用的 Git 版本是什么? - VonC
显示剩余2条评论
3个回答

1
确保用户名主账户相同:您需要将代码推回到您拥有的存储库(已创建为用户名)。
或者,您需要通过被授予存储库访问权限来访问用户名,该权限由其所有者主账户授予。

0

确保您在Bitbucket上有访问权限。

检查方法:登录Bitbucket > 配置文件和设置 > 个人设置 > 应用程序密码 > 选择/授予所需访问权限。


0

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


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接