When using Github in either the terminal or Rstudio when It calls for your user name and password

Now in place of a password you must put a personal access token
First go to your git Profile
Then like your Avatar image you should see this screen

Now go to Developer settings at the bottom of your tabs

click on the Personal access tokens tab

Lastly click on the box that says ‘Generate new token’

I selected all scopes but if you wish for more security you can create different tokens for various scopes

Now save your token in a safe place
You will use this when github asks for a password in both the terminal and R