解決git提示Permission denied (publickey)
阿新 • • 發佈:2018-12-05
一共分為兩部:
1.在命令列下:
生成金鑰: ssh-keygen -t rsa -C "tx" tx 可以換成你想要的其他的名字
有需要輸入的直接enter跳過就可以,不用設定密碼,要不以後每次clone都要輸入密碼,麻煩
[email protected]:~$ ssh-keygen -t rsa -C "tx" Generating public/private rsa key pair. Enter file in which to save the key (/home/shl/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/shl/.ssh/id_rsa. Your public key has been saved in /home/shl/.ssh/id_rsa.pub. The key fingerprint is: SHA256:09NO3UEYr9zwM+lS+hIl83uCuE1QVonNBHEZa06GblA tx The key's randomart image is: +---[RSA 2048]----+ | EOB= | | ..=B. | | . +.=o | | . *.O=oo| | S + =oBB.| | . * .+.o| | .o+...| | .o..+..| | ... .o.| +----[SHA256]-----+
2. 命令列下輸入: cat /home/shl/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC3hNw/xETxEyRppLZ+MW+imNhJW3ySjESZdylGZZRx0J6zUWjucSD8qFJhUbQhwA6E182qes+AYuR+Yg3hT3cOYTPe14rr9JECGzAnQ9BEBq0HrzICqx1Liq+cOC4N6KNawh9r2/vytoNoaAZ46cn0em9m9SgoTW9Ld2h2Zv0NR0svvm9IAXxhJ9C4WezebP5jn9rCOn1VwaF36639hBjI5h7Sc9Kh6PzwblWXKU8rmJKs8H794xE5FVmrzVIWKpLtbx3smZYKFOLm9NZV9ORV18iYeM2UKmezRl4m26Lu/mJ5eEmbElx44NeyBPUOPb9vPX70y1Q1IptYrmDcZQ8l tx
把生成的輸入到github的 setting->SSH and GPG keys 下的key中即可