gitgithubjekyllgithub-pages

Unable to Access Github 403 Error: Permission Denied


I'm very much a newcomer to Git / Github, so please excuse my confusion!

Here's the rub: I just made changes to a local repository, and would like to push to origin (specifically gh-pages) on Github. Previously, I'd been working with another Github account, so I changed my 'user.name' & 'user.email' to match the account I'm trying to push to now.

As of now, I get a 403 error and permission is denied.

What step am I missing? Going off other answers I've found, it would seem that changing my user.name & user.email should do the trick. Are there settings in git config that I need to change to get this working?

Any help, advice or constructive criticism is welcome, I'm just eager to get this working!


Solution

  • Check if your git installation is using the OSX Keychain to store credentials by running git config --global credential.helper. If that returns osxkeychain then it is.

    From https://help.github.com/articles/updating-credentials-from-the-osx-keychain/:

    You'll need to update your saved username and password in the git-credential-osxkeychain helper if you change your password or username on GitHub.

    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.

    Another thing you might need to check is if you are using 2 factor authentication for the github account you are pushing as? If you are then you might need this from here:

    When 2FA is enabled

    If you have two-factor authentication enabled, you must create a personal access token to use as a password when authenticating to GitHub on the command line with HTTPS URLs.

    For example, when you access a repository using Git on the command line using commands like git clone, git fetch, git pull or git push with HTTPS URLs, you must provide your GitHub username and your personal access token when prompted for a username and password.

    For more information on setting up two-factor authentication, see "Adding security to your account with two-factor authentication."