Personal Access Tokens.md 1.7 KB

#Personal Access Tokens

Personal Access Tokens are used for HTTPS authentication & linking to other projects for continuous integration type work

To create, select your profile (top right), Your Settings, then Applications (on the left list)

It should come up with Manage Personal Access Tokens

you can Generate New Token (it will ask for a Unique name for that Token) and the token (it looks like a list of random characters) will appear near the top - you must copy this to a text file & save as it will disappear after you leave the page

This token can then be used instead of a password for https authentication

#Adding a PAT to the git config for a project

The git config is inside the project in a hidden directory called .git - you can either edit the file called config in that directory directly or use something like GitHub Desktop to change the remote setting

In GitHub Desktop with the repo you want to change selected, select Repository from the menu, then select Repository Settings... at the bottom. It will bring up a window with Remote, Ignored Files, & Git Config on the left - select Remote

under Primary remote repository (origin) the url will be displayed

the format for https is

https://:@//.git

So without any username/password for the FGUK/FGUK-Test repo we get:

https://fguk.doghouselabs.dev/FGUK/FGUK-Test.git

To use the Personal Access Token we edit the line to something like this: (using the random string of characters that we copied to a text file earlier for personal-access-token)

https://your-username:personal-access-token@fguk.doghouselabs.dev/FGUK/FGUK-Test.git

You should then be able to access (push/pull) using https