gsingh2011 gsingh2011 - 1 month ago 5
Git Question

ERROR: Permission to user1/repo.git denied to user2

Someone I know is trying to clone my github repo and make changes directly to it. It's a public repo. He's cloned it with my read-write access link and he can pull from the repo. The problem is when he tries to push anything he gets the error

ERROR: Permission to user1/repo.git denied to user2

Where he's user2 and I'm user1. I've allowed other people to use different repos before and I've never had this problem. Am I missing something to allow him access or did github change? I've seen this on the help page for github:

This error occurs when you attach your key as a deploy key on repo1.
You can push and pull from that repo without issue, but you won’t have
access to any other repo with your key. To solve this, remove the key
from repo1’s deploy keys and attach it on your account page instead.
This key will now have access to all repos your account has access to.

We haven't messed with the deploy keys, but I can't find any other solution on the web.


I was stupid and didn't add them as collaborators.

To do this, follow these instructions:

  1. Go to Repository > Admin > Collaborators
  2. You will see a text box with a Add button. In order to add a collaborator you start typing in the text box until you see the actual username suggested to you in the drop down list that appears as you type.
  3. Select that username which will cause a green check mark to appear indicating the system recognized that username.
  4. Press Add to add that collaborator to the repository.

You can also watch this octocast: