Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github authenticates but will not allow code push

Tags:

git

github

I am the owner for the "project" repo, but somehow I am not able to push to it.

user@none ~/rails_projects/project $ git remote -v
origin  [email protected]:user/project.git (fetch)
origin  [email protected]:user/project.git (push)

Here is authentication check:

user@none ~/rails_projects/project $ ssh -T [email protected]
Hi user/project! You've successfully authenticated, but GitHub does not provide shell access.

Push attempt:

user@none ~/rails_projects/project $ git push origin qa
ERROR: The key you are authenticating with has been marked as read only.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Any idea how to fix this error?

like image 471
Abram Avatar asked Sep 09 '25 17:09

Abram


1 Answers

It seems likely that you have more than one SSH key, and the key that's being presented is a deploy key for the repository rather than one of your account's keys with write permissions. There are two ways of dealing with this:

  1. Remove all keys from your SSH agent, and re-add just the correct account key.

    ssh-add -D
    ssh-add /path/to/correct/key
    
  2. Use HTTPS instead of SSH. You can do this easily by changing the remote URL for origin to use the HTTPS scheme instead of SSH.

One or the other of these should work, unless you are simply presenting the wrong credentials altogether.

like image 131
Todd A. Jacobs Avatar answered Sep 12 '25 08:09

Todd A. Jacobs