Home > Mobile >  How to use a new token to push to github?
How to use a new token to push to github?

Time:02-08

In order to push something to github it looks like I need to create a new token (again...). But what that new token, how do I tell git to use a new token? What command do I have to use to use the new token?

CodePudding user response:

From the GitHub doc :

Once you have a token, you can enter it instead of your password when performing Git operations over HTTPS.

so just make sure that the old token is no longer cached in your laptop and use the token generated as a password

you can find in the link how to create a new token

CodePudding user response:

It seems that git does not provide a 'nice' way to update your token. But here is how you can do it:

  1. You remove the old origin

    git remote remove origin
    
  2. You add the new origin with the token integrated, i.e.

    git remote add origin https://<token>@github.com/<username>/<reponame>.git
    

so it looks like e.g.

git remote add origin https://[email protected]/alex526/myrepo.git
  •  Tags:  
  • Related