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

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

  • How do I add an empty directory in Git?
  • “git filter-branch” successfully used to change committer/author, but changes don't reflect on github
  • git clone timed out when used through https proxy
  • omnibus or source - can't decide which one to use for gitllab backup/restore
  • GitHub for Windows : how to unset svn-remote.svn.url
  • Adding project back under git control?
  • Contributions not showing up under Github profile?
  • git branch - local or what?
  • 2 Solutions collect form web for “Git thinks I'm a different user, won't give me access to github repo”

    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 git@github.com: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.

    Did you try below?

    git config --global user.name "bclayman"
    git config --global user.email "email_addr_of_bclayman"
    

    And also make sure under your ~/.ssh folder, no ssh key related to Mariogs37, if any, delete them. Only keep ssh key of bclayman.

    Git Baby is a git and github fan, let's start git clone.