Hey Greetings of the day!!
There are two choices for PAT
1. fine grain Personal Access Token(PAT)
2. Personal Access Token (Classic)
I understood that it is easy to change permissions, authentication token that use only specific target repositories.
If you want to know 'How PAT works? Where to start PAT' then this post is absolutely for you! Welcome to this 2 mins read!
- Fine grained PAT newly introduced in Oct 2022 on the GitHub still at the time this post it is mentioned as [Beta] versioned.
- Personal Access Token PATS are going to work with commonly defined API on GitHub. Any integration made simplified with this method.
How to create PAT on GitHub?
- Login to your GitHub account. Click on the profile picture upper-right corner, from there select the 'Settings' menu item.
- The left bottom, PAT will be defined under the 'Developer Settings' there you will get new page with 'Personal Access Tokens' into the work area select your choice. There are many actions related to each row tells about a granular choices that GitHub could provide.
- Go to right side 'Generate Token' will be a button to hit. Then it will prompt you for login credentials to be entered. Then New personal access token parameters will need to be filled up. 1. Note - alias a authentication methods let's enter the note as "vt_demo_token"
- Select the scope - 'repo' is enough, where it will be containing repo:status, repo_deployment, public_repo, repo:invite, security_events.
- Click on the "Generate Token" button new page will have the token. Make sure to copy your new personal access token now. Remember that you won't be able to see it again eventhough you have created it. As soon as click away of this page you will not get the value any more.
Preserving the TOKEN on your Linux system
Create an environment variable store it inside .bash_profile.
Use the following command to set the remote repository:
After setting this all remote operations push, pull are no user access prompted.
If you find this post is useful please share this to your technical communities :)
MY_GITHUB_TOKEN=GENERATED-TOKEN-VALUE-COPIED FROM GitHub PAT page.How do I access remote GitHub repository?
Use the following command to set the remote repository:
git remote origin https://github-remote-repo-urlUse the following command to check the remote repository
git remote -vHere -v option indicates that verbose of the remote url and fetch and pull commands could connect with the URLS shown as above command output. push the changes to remote GitHub repository.
git push -u origin https://git-urlIt will prompt for the Password then enter the TOKEN value which is already copied that you can paste here. To store the password you don't want to see the prompting every push, pull activities. To avoice that you can set the remote url as follows:
git remote set-url https://api:$MY_GITHUB_TOKEN@github.com/REMOTE-USER/REMOTE-REPO.gitExample:
git remote set-url https://api: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@github.com/SanjayDevOps2022/football.git
After setting this all remote operations push, pull are no user access prompted.
If you find this post is useful please share this to your technical communities :)
No comments:
Post a Comment