[Solved] Update GitHub authentication to use token on macOS (rather than password)

Article Sharif Ahmed

As password authentication no longer exists in Github you have to use Personal Access Token to perform git operations. To use the access token you have to update your local machine's git credentials.

In this article, we will show some easy solutions to update GitHub authentication to use token on macOS rather than password.

First, you have to create a Github Personal Access Token from your Github profile. If you don't know how to create one you can check this article.

After creating a git personal access token then you have to follow the below solutions to solve your problems.


Solution 1:

  • First, remove the previous credential from your local machine. Open terminal and run
    git config --global --unset credential.helper
    git credential-osxkeychain erase
    host=github.com
    protocol=https
  • Then open a new terminal and run the following commands to set Name and Username
    git config --global user.name "Enter Your Name"
    git config --global user.email you@example.com
  • Now run a git push or git clone command on a private repository so GitHub prompts you to enter your username and password. Here enter your Github username and personal access token as the password.
    git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY 
    > Cloning into ... 
    Username for 'https://github.com' : Enter your github username 
    Password for 'https://github.com' : Enter your github personal access token here

  • Solution 2:

  • First, open mac search by clicking on the Spotlight icon on the right side of the navigation bar.
  • Then, Search for "keychain" and open the Keychain Access app
  • Next, Search for Github and You will find two options: an application password and an internet password
  • Click on the internet password and check the Show password. Finally, replace the password with our Personal Access Token.

  • Thank you for reading the article. You can contact us if you face any problems.