2

I created an organization on GitHub and I'm the owner of it. I created a repo into this organization, initialized with a Readme. I cloned it with ssh without any problem. I made some changes to commit, and when I tried to push to remote origin :

$ git push
ERROR: Permission to Organization/repo.git denied to EtienneWan.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
$ ssh -T git@github.com
Hi EtienneWan! You've successfully authenticated, but GitHub does not provide shell access.

I'm the owner of my organization, so I don't understand why I can't push when I cloned without problems.

EDIT: I cloned with git@github.com:Organization/repo.git
2nd EDIT: The key I was using was added by a GitHub app. Check my answer, I resolved my problem.

Etienne Wan
  • 257
  • 3
  • 11
  • possible duplicate of [Could not read from remote repository](http://stackoverflow.com/questions/16245606/could-not-read-from-remote-repository) – Cristik Apr 18 '15 at 18:44

2 Answers2

6

Strangely, what I did is to remove and readd my public key to GitHub.
Now pushing to organization repos works. It's strange, because I could push as normal to my repositories, meaning my key was correct before. But much more correct after re-entering it.
Weird ...
EDIT : It appears that the ssh key that I was using was added to GitHub with a GH app, which didn't have granted access to my organizations. Deleting the key and adding it manually made the key become independent of the GH app, and made possible to push to those repos. I could have granted access to each one of my repo to the GH app, but I preferred revoking the app and handling all of it myself.

Juergen
  • 12,378
  • 7
  • 39
  • 55
Etienne Wan
  • 257
  • 3
  • 11
0

You need to do

git push origin master

supposing you cloned it correctly with git clone

not just git push.

Andrey Deineko
  • 51,333
  • 10
  • 112
  • 145
  • Have you searched your error... this comes up quite a bit really. http://stackoverflow.com/questions/16118797/git-push-to-remote-repository-could-not-read-from-remote-repository –  Apr 18 '15 at 14:51
  • I've got no problems when cloning and pushing to repos that are mine. But in an organization where I'm the owner, I got this error. I suppose it's not a problem of ssh-key. But I don't know why that doesn't work. – Etienne Wan Apr 18 '15 at 14:55