Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git thinks I'm a different user, won't give me access to github repo

Tags:

git

github

I had an account on github (Mariogs37) that I've since stopped using. In the meantime, I've created a new one (bclayman) that I'd like to start using. I created a repo on github and ran:

git remote add origin https://github.com/bclayman/SquashScraper.git

I get no error messages, and then I run:

git push -u origin master

However, I get this error message:

remote: Permission to bclayman/SquashScraper.git denied to Mariogs37.
fatal: unable to access 'https://github.com/bclayman/SquashScraper.git/': The requested URL returned error: 403

I googled around for similar issues and came across this link:

http://stackoverflow.com/questions/24019258/git-thinks-im-the-wrong-user

I followed vonC's answer's instructions (here: https://help.github.com/articles/generating-ssh-keys/#step-3-add-your-ssh-key-to-github). At the end of adding my SSH key to github, I got this in my terminal:

Hi bclayman! You've successfully authenticated, but GitHub does not provide shell access.

I retried pushing my local repo to github but have run into the same error. Any idea why it still thinks I'm Mariogs37 (and thus don't have permissions to push to a repo on github owned by bclayman)?

Thanks,

bclayman

like image 592
anon_swe Avatar asked Jun 03 '15 17:06

anon_swe


People also ask

Can't connect to the repository Github?

Go to Window -> Preferences -> Team -> Git -> Configuration, click 'Repository Settings' tab and paste your GIT ssh URI to remote.

How do I give permission to github repository?

Under your repository name, click Settings. In the "Access" section of the sidebar, click Collaborators & teams. Click Invite a collaborator. In the search field, start typing the name of person you want to invite, then click a name in the list of matches.

How do you solve please make sure you have the correct access rights and the repository exists?

The “Please make sure you have the correct access rights” error occurs if you do not have the right permissions to access a Git repository. To solve this error, make sure you are referring to the correct remote URL and that you have set up SSH authentication correctly.

Can two people own a github repo?

Repositories owned by personal accounts have one owner. Ownership permissions can't be shared with another personal account. You can also invite users on GitHub to your repository as collaborators.


1 Answers

This most likely is a misunderstanding in what credentials are used for what.

GitHub offers you to use two different protocols to access your repo:

  • HTTPS
  • SSH

SSH:

This one uses the ssh keys and settings in your ~/.ssh folder. It is used if you add a remote like this:

git remote add origin [email protected]:bclayman/SquashScraper.git

HTTPS (the one you chose):

This one uses the https credentials that depending on your system could be stored in various places (if at all). As it seems you're using the OS X Keychain, so they are most likely stored there. The https protocol is used if you add a remote like this:

git remote add origin https://github.com/bclayman/SquashScraper.git

So to get this resolved i'd open your OS X Keychain and search for https://github.com and delete all items that come up. Next time you try to push / fetch it should ask you for your username and password again.

like image 97
Jörn Hees Avatar answered Oct 26 '22 08:10

Jörn Hees