I'm on Ubuntu 20.04 (Focal Fossa) and I kept getting the message that soon I wouldn't be able to log in from console. I was terribly confused.
Finally, I got to the URL below which will work. But you need to know how to create a PAT (personal access token) which you are going to have to keep in a file on your computer.
Here's what the final URL will look like:
git push https://[email protected]/user-name/repo.git
long PAT (personal access token) value -- The entire long value between the // and the @ sign in the URL is your PAT.
user-name will be your exact username
repo.git will be your exact repository name
Also you will be able to use it this way too:
When you do a
git push
1. You'll be prompted for a username and password
2. Just submit your username as normal
3. Now submit your PAT as your password and it will work.
You need to generate a PAT following the steps at: Creating a personal access token
That will give you the PAT value that you will place in your URL.
When you create the PAT make sure you choose the following options so it has the ability to allow you to manage your repositories.
Save Your PAT Or Lose It
Once you have your PAT, you're going to need to save it in a file locally so you can use it again. If you don't save it somewhere there is no way to ever see it again and you'll be forced to create a new PAT.
Now you're going to need at the very least:
- a way to display it in your console so you can see it again.
- or, a way to copy it to your clipboard automatically.
For 1, just use:
cat ~/files/myPatFile.txt
Where the path is a real path to the location and file where you stored your PAT value.
For 2
xclip -selection clipboard < ~/files/myPatFile.txt
That'll copy the contents of the file to the clipboard so you can use your PAT more easily.
FYI - if you don't have xclip do the following:
sudo apt-get install xclip
It downloads and installs xclip. If you don't have apt-get
, you might need to use another installer (like YUM).
git config --global credential.helper store
, then simply clone some private repo you have access to. Git cli will ask for username/password. Password is your token. After that git cli remembers the credentials – Siler