How to update expired GitHub token on local git remote config


If you GitHub Personal access token that you were using to push your code has expired and you want to update it, then follow the below steps,

  1. Make sure you have generate the new token - if not follow this tutorial - Generate new authentication token
    GitHub expired Personal access tokens
  2. Now make a note of the token generated and create run he below in Terminal,
    % git remote set-url origin https://your-user-name:ghp_XXXXXX_Your_Tocken@github.com/your-user-name/your-repo-name
.git
  • That is it!
  • Advertisements
    Try Out Code2care Dev Tools:

    Advertisements

    Advertisements
    Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

    Students and software developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include learnings, tutorials, trouble-shooting steps, video tutorials, code snippets, how-to, blogs, articles, etc.

    🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

    We strongly support Gender Equality & Diversity.