Git第一次新建项目添加ssh key

Posted -ios

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Git第一次新建项目添加ssh key相关的知识,希望对你有一定的参考价值。

Git第一次新建项目添加ssh key

Last login: Mon Sep  3 08:59:35 on console

localhost:~ dajiang$ cd ~/.ssh

-bash: cd: /Users/dajiang/.ssh: No such file or directory

localhost:~ dajiang$ sudo apt-get install git

Password:

sudo: apt-get: command not found

localhost:~ dajiang$ git config --global user.name "dajiang"

localhost:~ dajiang$ git config --global user.email "[email protected]"

localhost:~ dajiang$ git config user.name

dajiang

localhost:~ dajiang$ git config user.email

[email protected]

localhost:~ dajiang$ git config --list

credential.helper=osxkeychain

user.name=dajiang

[email protected]

localhost:~ dajiang$ ssh-keygen -t rsa -c "[email protected]"

Too many arguments.

usage: ssh-keygen [-q] [-b bits] [-t dsa | ecdsa | ed25519 | rsa]

                  [-N new_passphrase] [-C comment] [-f output_keyfile]

       ssh-keygen -p [-P old_passphrase] [-N new_passphrase] [-f keyfile]

       ssh-keygen -i [-m key_format] [-f input_keyfile]

       ssh-keygen -e [-m key_format] [-f input_keyfile]

       ssh-keygen -y [-f input_keyfile]

       ssh-keygen -c [-P passphrase] [-C comment] [-f keyfile]

       ssh-keygen -l [-v] [-E fingerprint_hash] [-f input_keyfile]

       ssh-keygen -B [-f input_keyfile]

       ssh-keygen -D pkcs11

       ssh-keygen -F hostname [-f known_hosts_file] [-l]

       ssh-keygen -H [-f known_hosts_file]

       ssh-keygen -R hostname [-f known_hosts_file]

       ssh-keygen -r hostname [-f input_keyfile] [-g]

       ssh-keygen -G output_file [-v] [-b bits] [-M memory] [-S start_point]

       ssh-keygen -T output_file -f input_file [-v] [-a rounds] [-J num_lines]

                  [-j start_line] [-K checkpt] [-W generator]

       ssh-keygen -s ca_key -I certificate_identity [-h] [-U]

                  [-D pkcs11_provider] [-n principals] [-O option]

                  [-V validity_interval] [-z serial_number] file ...

       ssh-keygen -L [-f input_keyfile]

       ssh-keygen -A

       ssh-keygen -k -f krl_file [-u] [-s ca_public] [-z version_number]

                  file ...

       ssh-keygen -Q -f krl_file file ...

localhost:~ dajiang$ ls

Desktop Downloads Movies Pictures

Documents Library Music Public

localhost:~ dajiang$ ssh-keygen -t rsa -C "[email protected]"

Generating public/private rsa key pair.

Enter file in which to save the key (/Users/dajiang/.ssh/id_rsa): 

Created directory ‘/Users/dajiang/.ssh‘.

Enter passphrase (empty for no passphrase): 不用输入密码,直接回车

Enter same passphrase again: 

Passphrases do not match.  Try again.

Enter passphrase (empty for no passphrase): 

Enter same passphrase again: 

Passphrases do not match.  Try again.

Enter passphrase (empty for no passphrase): 

Enter same passphrase again: 

Passphrases do not match.  Try again.

Enter passphrase (empty for no passphrase): 

Enter same passphrase again: 

Passphrases do not match.  Try again.

Enter passphrase (empty for no passphrase): 

Enter same passphrase again: 

Your identification has been saved in /Users/dajiang/.ssh/id_rsa.

Your public key has been saved in /Users/dajiang/.ssh/id_rsa.pub.

The key fingerprint is:

SHA256:RrygeBb/LIak8pmAjDAYALOn3uTjpqMgfctsqw62rWY [email protected]

The key‘s randomart image is:

+---[RSA 2048]----+

|=                |

|.o     .         |

|o . . . o        |

|.+ . + o .       |

|= ..= . S        |

|*o+= . +         |

|O+o+o o o        |

|+E+Boo .         |

|[email protected]==.           |

+----[SHA256]-----+

localhost:~ dajiang$ 

localhost:~ dajiang$ l

-bash: l: command not found

localhost:~ dajiang$ ls

Desktop Downloads Movies Pictures

Documents Library Music Public

localhost:~ dajiang$  长的、

-bash:  长的、: command not found

localhost:~ dajiang$ cd

localhost:~ dajiang$ ls

Desktop Downloads Movies Pictures

Documents Library Music Public

localhost:~ dajiang$ cd .ssh/

localhost:.ssh dajiang$ ls

id_rsa id_rsa.pub

localhost:.ssh dajiang$ cat id_rsa

-----BEGIN RSA PRIVATE KEY-----

MIIEpAIBAAKCAQEA7Pivtbvn9oX+8TszA8fCwL2jqPgm8cSI4z1l5Mlo770PXi/l

MMTpBA3EabgduoP5klDW0OTic4/qpq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eAzMP1KYfIMjGd0l+/xLPJq8DwVmNJb3q8Rk1EYplED7coUIYubMTtoyY

ai+OfKU2YLOY5Xq2YuxboxECgYEAqeWi9JRWZWB9UBKTN436p4gwcpAk+1kPel7f

8me+Vwe3ra6wEwbTQ3pHBVmtqcAbLR1hYaPwJXO+kn1TxBRlzLxN7xwjVac7uwAK

8ry9Wk/N9Qwopugtl9zxf8oX8nnq/SXxmmuNkx2hkOxJ3CJxkrHevomtKL+KUUOs

gtcXCcECgYBNdogoqAj/gCIxvmQnZSikR5bAQfsQEmUho43ETyXhSMy5iDi3GSEd

HhGYXl91peWE5Nq0t4OZA6j8+KcG/qhCC9G6BEPI5F01a9iCus2jaomK1/AJ2AKK

cDWU0WAwfyaRWSdGc0IZfwN7alAK/SO1h1PDWmYvV4DHQCP0f1Dasw==

-----END RSA PRIVATE KEY-----

localhost:.ssh dajiang$ cat id_rsa.pub 

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDs+K+1u+f2hf7xOzMDx8LAvaOo+CbxxIjjPWXkyWjvvQ9eL+UwxOkEDcRpuB26g/mSUNbQ5OJzj+qmpwQ/SwfApMeCT5DIflphhacNei9cU1ApG1GHF4SjepeVw03pkaYFVmiJqI97d7a7E2EkXaYc//gtjWThLGktq18mPXGiTz1NFNV1o1F1plx2l/bqR0sm8lgXg0Nau0RPrcztq3gwMpz546Pd7lkIzYZclgr14f8gVRbEwGBvJLWIjAu+9k5IiZsyHxeQ7ERW3DR5Jkjde7fklbkPjWQ0IPJQclQMhQUlUqsmc60+ANRuUSCL4EVza65xz7OUzkMoXhbFWis1 [email protected]

localhost:.ssh dajiang$ 

 

以上是关于Git第一次新建项目添加ssh key的主要内容,如果未能解决你的问题,请参考以下文章

git 码云使用教程

git SSh key多个key对应多个项目

2017.6.30 使用git新建项目仓库并拉取提交代码

如何从远程git服务器上拉取一个新建的git项目

在Git中添加一个项目

Jenkins项目新建-git插件使用