Git

Git ssh public key

2019-03-14  本文已影响0人  JaedenKil

Refer to generate ssh public key.

Sometimes when do a git clone, server may shows an error telling public key not available.

  1. 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.

  1. 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
  1. Can cat id_rsa.pub and copy the content, in the git server settings, add the content to something like SSH Public Keys.
    Refresh the web, then git clone should be okay.
上一篇下一篇

猜你喜欢

热点阅读