Generating a token in Git
Git supports pushing the files to the repo only through tokens.
Here will explain how to generate tokens for Git access.
- Login to your Github Account
2. Access url: https://github.com/settings/tokens
3. Enter: Generate Token
4. Provide some info in Note
5. Select required checkboxes (I selected all checkbox)
6. Click Generate Token
A token will be generated for you.
You have to use the generated token to do git clone.
How to git clone with generated token
For eg:
Username is : johndoe
Generated Token is : ghp_abc123
Repo is : greetings
Then the git repo url will be :
https://johndoe:ghp_abc123@github.com/johndoe/greetings.git
7. Once the token is generated, you can also set it globally in gitconfig
$ git config --global url."https://${username}:${access_token}@github.com".insteadOf "https://github.com"Eg: git config --global url."https://johndoe:ghp_abc123@github.com".insteadOf "https://github.com"