Unable to Paste a PAT from GitHub to Cloud9 Ruby on Rails

297 Views Asked by At

I am trying to paste a Personal Access Token that I created in GitHub into the command line of a Ruby on Rails program I'm developing on Cloud9. I put in my GitHub username, and when I try to put in the PAT under password, it won't paste. I've tried with 2 different apps, but can't complete the git push. As a result I can't deploy my app to production.

I'm new at RnR, so have been learning using https://www.railstutorial.org/ following these instructions. I would appreciate any help I could get.

[website (main)]$ git remote add origin https://github.com/mhartl/hello_app.git
[website (main)]$ git branch -M main
[website (main)]$ git push -u origin main

After running the third command you will be prompted to enter your username and password. The username is simply your GitHub username, but the password is not your GitHub password; instead, the “password” must be a personal access token which you can create by following the instructions in the GitHub article “Creating a personal access token” I suggest selecting “No expiration” for the token expiration, and also be sure to select “repo” as the scope of the token so that it works at the command line. Once you’ve created and saved the personal access token, paste it in at the command line when prompted for a password to complete the git push

1

There are 1 best solutions below

7
VonC On

Check if it actually won't paste, meaning: when you paste a password, often it is not displayed at all: you get the impression the paste failed because nothing moved.

But do try, just after pasting, to click enter and the PAT should be taken into account, even if it remains "invisible".

Check also your git config --global credential.helper: a caching mechanism can help you not entering the PAT on each clone/push/pull operation.
At least, for instance, git config --global credential.helper "cache --timeout=86400"

You can see what is cached with:

printf "host=github.com\nprotocol=https"|git-credential-cache get

You can remove it with

printf "host=github.com\nprotocol=https\nusername=you"|git-credential-cache erase

You can store the new PAT with

printf "host=github.com\nprotocol=https\nusername=you\npassword=yourPAT"|git-credential-cache store