Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can not push code to the project - error 403

I'm facing a problem when I try to push my code to the project. Git shows error message:

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
    

I have permission to the repository, my SSH key is not expired (I also created a new one). I can't push but I can fetch code from the project. No idea what's going on. I use Androd Studio.

like image 461
Wafi_ck Avatar asked Mar 20 '26 01:03

Wafi_ck


1 Answers

It looks like you are using https rather than ssh to push to your repository, hence not using your ssh key.

Some steps to change the URL for your remote repository:

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 [email protected]: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   [email protected]:project/repo.git (fetch)
# origin   [email protected]:project/repo.git (push)
like image 100
Rekovni Avatar answered Mar 22 '26 14:03

Rekovni



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!