###### tags: `Git` `Tutorials`
# Tokens
---
## The problem
- Github has updated it's policies and many users are now having difficulty pushing to older repositories. Sometimes creating a new repository and cloning it down also has issues.
- Getting errors that look kinda scary. Something like this.

- Don't panic it's not fatal.
## The solutions
- 1st you need to create a personal access token.
- Go to Settings
- Developer Settings (at the bottom of the settings page)
- 
- Then Personal Access Tokens
- 
- Next you will need to give the token a name, chose the expirations date (I recommend 90 days), and click all the boxes
- 
- If you are creating the token for another site like say [Coders Rank](https://codersrank.io) then you might want to change some of the permisions, if it is for you then you want to be sure to check them all.
- 
- Once it is generated you will then see your token
- 
:::danger
Save this token someplace safe. I use a spreadsheet to save the tokens for my different accounts. But this will be the ONLY time you will see this token so be sure to save it.
:::
## Using your token
Now that you have your token there are 2 ways you will use it. Updating current repositorys to push back to github and cloning new ones down
### Cloning a repo with the token
- You will want to use the following format
- `git clone https://<token>@github.com/<username>/<repoName>.git`
- If it is an organization repository be sure to use that name in place of the user name
- Here is an example:
- 
### Updating a local repo with the new token
- This can be done to any repo that you have localy even if you have already added a token. When it expires you will need to update it as you will get a very similar error to the one above.
- Use the following format to update any local repo with the new token
- `git remote set-url origin https://<token>@github.com/<username>/<repoName>.git`
- Here is an example:
- 