无法将代码推送到项目-错误403 [英] Can not push code to the project - error 403

查看:31
本文介绍了无法将代码推送到项目-错误403的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试将我的代码推送到项目时,我遇到了一个问题。Git显示错误消息:

Push failed
Remote: You are not allowed to push code to this project.
unable to access 'https://gitlab.name.com/project/repo.git/': The requested URL returned error: 403
    

我有权访问存储库,我的SSH密钥没有过期(我还创建了一个新密钥)。我不能推,但我可以从项目中获取代码。不知道发生了什么事。 我用的是Androd Studio。

推荐答案

看起来您使用的是https而不是ssh推送到存储库,因此没有使用ssh键。

更改远程存储库URL的一些步骤:

git remote -v
# Should see
# origin   https://gitlab.name.com/project/repo.git (fetch)
# origin   https://gitlab.name.com/project/repo.git (push)

git remote set-url origin git@gitlab.name.com:project/repo.git
# you should be able to get the SSH url from the GitLab UI if in doubt

git remote -v
# verify changes
# origin   git@gitlab.name.com:project/repo.git (fetch)
# origin   git@gitlab.name.com:project/repo.git (push)

这篇关于无法将代码推送到项目-错误403的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆