7

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.

gsgx
  • 12,020
  • 25
  • 98
  • 149
  • 1
    Check your email. Github just fixed a vulnerability around its ssh keys, so you'll need to re-approve any ssh keys before you can use them. https://github.com/settings/ssh/audit – CG Morton Mar 07 '12 at 19:44
  • I've verified my own keys, but he added his key and cloned it today. It says verified for his too because of this. – gsgx Mar 07 '12 at 19:58
  • Go to CONTROL PANEL->USER ACCOUNT->Credential Manager->Windows Credential ->delete all credential related to git – Avnish Nishad Dec 02 '18 at 19:20

7 Answers7

10

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: http://screencast.com/t/m7yN19N4645h

gsgx
  • 12,020
  • 25
  • 98
  • 149
8

You first need to remove the last ssh connection.

To remove the last ssh connection, follow this command:

ssh-add -D

then try to push.

Damien
  • 1,161
  • 2
  • 19
  • 31
6

The problem comes from Windows Credential Manager, and you just need to delete the git account there:

Control Panel——>User Account and family Safety——>Manage Windows Credential——>remove the github account

Windows Credentials

crusy
  • 1,424
  • 2
  • 25
  • 54
Lucius Zhao
  • 71
  • 1
  • 3
3

Updating your credentials via Keychain Access in macOS

  1. In Finder, search for the Keychain Access app.
  2. In Keychain Access, search for github.com.
  3. GitHub Password Entry in KeychainFind the "internet password" entry for github.com.
  4. Edit or delete the entry accordingly.
Long Nguyen
  • 9,898
  • 5
  • 53
  • 52
2

window user follows this :-

Go to CONTROL PANEL->USER ACCOUNT->Credential Manager->Windows Credential 
->delete all credential related to git

now go to gitbash and proceed as normal,

a new popup window will open which ask for your username and password.

Avnish Nishad
  • 1,634
  • 1
  • 17
  • 18
1

Same problem with me.

If you used git config credential.helper store to cache your user1 credential, you should remove it from cache file.

You have to edit ~/.git-credentials file where your credentials cached.

Just remove the account you don't need.

https://user1:pass1@github.com
https://user2:pass2@bitbucket.org
fredmaggiowski
  • 2,232
  • 3
  • 25
  • 44
1

GitHub had a minor security breach recently and as a result, you will need to log in and approve each valid SSH key in your profile. This link to do this is:

https://github.com/settings/ssh/audit

If you're stuck, see this answer on how to generate your RSA fingerprint.

Community
  • 1
  • 1
Marvin Pinto
  • 30,138
  • 7
  • 37
  • 54
  • This didn't work. I've made a second account to test this error. I clone the read+write SSH link with my second account, and I can't push to the repository created by my first account. Here is a repository I've made on the second account. It's the read+write link, so if you can figure out how to push to it, my problem would be solved. Do whatever you want to it, it's only for fixing this problem: git@github.com:gsingh2011/test.git – gsgx Mar 11 '12 at 21:02