Refer to generate ssh public key.
Sometimes when do a git clone
, server may shows an error telling public key not available.
- Check ssh public key:
# User current user directory, for instance /c/Users/xxx/
cd .ssh
ls -al # Check if there are files named as `id_dsa` or `id_rsa`.
If there is one named like id_rsa.pub
, then public key is available.
- If file not found, then need to generate a key:
$ ssh-keygen -o
Generating public/private rsa key pair.
Enter file in which to save the key (/home/schacon/.ssh/id_rsa):
Created directory '/home/schacon/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/schacon/.ssh/id_rsa.
Your public key has been saved in /home/schacon/.ssh/id_rsa.pub.
The key fingerprint is:
d0:82:24:8e:d7:f1:bb:9b:33:53:96:93:49:da:9b:e3 schacon@mylaptop.local
$ ls
id_rsa
id_rsa.pub
- Can
cat id_rsa.pub
and copy the content, in the git server settings, add the content to something likeSSH Public Keys
.
Refresh the web, thengit clone
should be okay.
网友评论