- Table of contents
- General purpose
- Generating your own personalized access code
- Create an Renviron file
Since copy-pasting is a sin, script stored in the library can be accessed in other scripts easily. Before this is possible, you need to make sure that your personalized access token and github email address are stored on your computer in an external file. How this is done, can be read below.
-
Generate a new token on GitHub
-
Add a note, describing where you are using this token for (example;
GITHUB_PAT
) -
Fill in the expiration date (example;
90 days
orNo expiration
) -
Select the following scopes:
- repo
- repo:status
- repo_deployment
- public_repo
- repo:invite
- security_events
- workflow
- write:packages
- read:packages
- delete:packages
- admin:org
- write:org
- read:org
- admin:public_key
- write:public_key
- read:public_key
- admin:repo_hook
- write:repo_hook
- read:repo_hook
- admin:org_hook
- gist
- notifications
- user
- read:user
- user:email
- user:follow
- delete_repo
- write:discussion
- read:discussion
- admin:enterprise
- manage_billing:enterprise
- read:enterprise
- admin:gpg_key
- write:gpg_key
- read:gpg_key
- repo
-
Click on
Generate token
-
Copy-paste the code which is highlighted in the green bar (this is your personalized access code)
If you want to have an overview about with codes are made, or if you want to remove or generate one, then you can go to the [Personalized access tokens] (https://github.com/settings/tokens) overview Additionally, a detailed overview is provided in the GitHub documents.
-
Open the terminal (Control + Option + Shift + T / Ctrl+Alt+T) and type
touch $HOME/.Renviron
-
To open the file you just created in the terminal using
open $HOME/.Renviron
-
Then write the following information:
GITHUB_MAIL=[github email]
GITHUB_PAT=[personalized access code]
- This will save and store the content in an
.Renviron
file which is located in the Home folder. - If you opened RStudio, then reopen this.
- As a test, run
Sys.getenv('GITHUB_MAIL')
to access the variable in R.
- Press Windows+R to open the Run dialog box, and then type
powershell
in the text box and open this. - Copy this code into powershell
Add-Content c:\Users\$env:USERNAME\Documents\.Renviron "GITHUB_MAIL=[github email]"
Add-Content c:\Users\$env:USERNAME\Documents\.Renviron "GITHUB_PAT=[personalized access code]"
- This will save and store the content in an
.Renviron
file in the Documents folder. - If you opened RStudio, then reopen this.
- As a test, run
Sys.getenv('GITHUB_MAIL')
to access the variable in R.
If you dont see anything when you run Sys.getenv('GITHUB_MAIL')
, then the first rule when something goes wrong is RTFM, however you can also try to bribe your favorite bioinformatician (maybe this works).