Home > OS >  Git how to set git to prompt fingerprint instead of password?
Git how to set git to prompt fingerprint instead of password?

Time:11-25

the first time when I use git clone, git asked about use password or finger print.

I choose password however the git clone failed at password authentication.

How do I reset git so that I can choose to use fingerprint? (I have setup ssh key fingerprint in my gitlab). I think fingerprint login method should works.

CodePudding user response:

First, check your git remote URL (git remote -v, from the root folder of your local repository): if it is HTTPS (https://...), no amount of SSH fingerprint would matter.

And if it is HTTPS, most Git remote hosting services (GitHub, GitLab, BitBucket) requires a token (PAT) as a password, not your actual account password. So make sure to use a token.

If it is SSH, check git config --local -l and see if there is any setting ssh / password related.

CodePudding user response:

install git

sudo apt update
sudo apt install git
sudo apt install git-lfs

configure

git config --list

git config --global user.name userA

git config --global user.email [email protected]

remove existing keys

cd ~/.ssh/

nano known_hosts  (remove content)

generate new key

ssh-keygen -t rsa -b 2048 -C newkey

install xclip to be able to copy key

    sudo apt install xclip

copy the key

xclip -sel clip < ~/.ssh/id_rsa.pub 

add the content to gitlab user preferences - ssh key new key

test

ssh -T [email protected] (enter yes, the test should be success Welcome to GitLab, @userA!)
  •  Tags:  
  • git
  • Related