Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OSX: git: remote: Permission to user/repo denied to otheruser

I am trying to push a new repo to github and am being prevented from doing so because git has cached meatwork credentials.

$ git push -u origin master
remote: Permission to me/me.github.io.git denied to meatwork.

After some digging around, I thought maybe credential.helper was the issue, so I tried to remove it bit git config still returns osxkeychain even though I have removed all settings.

$ git config --system credential.helper 
$ git config --global credential.helper 
$ git config --local credential.helper 
$ git config credential.helper
osxkeychain
$ 

Also looked at git credential-osxkeychain but it just hangs

$ git credential-osxkeychain get

So anyway back to the original problem, how do I specify or override or reset the default user being used by push. I checked the user.name and user.email settings and they are set to the correct user (not meatwork).

$ git config --local user.name
$ git config --global user.name
me
$ git config --system user.name
$ git config --local user.email
$ git config --global user.email
[email protected]
$ git config --system user.email

So where is git getting meatwork credentials from and how to I stop it.

like image 518
Austin France Avatar asked Nov 22 '16 10:11

Austin France


People also ask

How do I check permissions on a git repository?

Open the web portal and choose the project where you want to add users or groups. To choose another project, see Switch project, repository, team. Open Project settings>Repositories. To set the permissions for all Git repositories, choose Security.


2 Answers

my solution is (on Mac):

  1. Open Keychain Access app.
  2. Search for github.com
  3. Delete the information of other users

And see if it works now.

My situation is, someone has used my Mac to log into his Github, and Mac remembers his name and password, which is why permission is denied to him...


Reference: Updating credentials from the OSX Keychain | Github Help

like image 105
lleiou Avatar answered Jan 04 '23 10:01

lleiou


Well, the simple answer to the second part of my question thanks to a hint found here https://git-scm.com/docs/gitcredentials

Setting the credential.username property for the cloned repository to the username I want to use did the trick.

$ git config credential.username me

And now my push works! I still don't know where meatwork is coming from though.

Alternatively, editing .git/config and changing the [remote "origin"] url= to include username@ in the URL also works.

[remote "origin"]
  url = https://[email protected]/Me/me.github.io.git
like image 26
Austin France Avatar answered Jan 04 '23 11:01

Austin France