Search Posts

How to get Git token

To push to a Git repository with a personal access token, you can create a new token on GitHub, GitLab, or other platforms. Here’s how you can get a personal access token on GitHub:

1. Navigate to Settings

Go to GitHub and sign in.
Click on your profile picture in the upper-right corner and select Settings from the dropdown menu.

2. Access Developer Settings

Scroll down on the left sidebar and find Developer settings.

3. Generate a New Token

In the Developer settings menu, select Personal access tokens > Tokens (classic).
Click Generate new token or Generate new token (classic).

4. Configure Token Permissions

Give the token a Note (like "Git Push Access") to remember why you created it.
Set an Expiration date (choose a specific timeframe or "No Expiration" if you want it to last indefinitely).
Choose the appropriate Scopes for the token. For pushing code, select:
repo (for full control of private repositories)
Scroll down and click Generate token.

5. Copy the Token

Once the token is generated, copy it immediately because it will not be shown again.
Store it in a secure location.

6. Use the Token with Git

When prompted for a username and password when pushing to your Git repository, use the token as the password:

7. For easier use, you can also configure Git to remember your credentials:

git config --global credential.helper store

Now, you should be able to push to your repository using the token without entering it every time.