創(chuàng)建SSH Key
- $ ssh-keygen -t rsa -C 賬戶名 //直接各種回車
- 在電腦個人用戶主目錄找到隱藏文件夾 .ssh窥妇,打開有id_rsa爱榔、id_rsa.pub這兩個文件
- id_rsa可以直接打開,id_rsa.pub蘋果電腦不能打開豁陆,可以通過命令 (1)cd ~/.ssh 切換到目錄 (2)more id_rsa.pub在終端直接顯示出文件內(nèi)容
====
Last login: Thu Mar 22 14:02:07 on ttys002
cuilinhaodeMacBook-Pro:~ cuilinhao$ ssh-keygen -t rsa -C cuilinhao
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/cuilinhao/.ssh/id_rsa):
/Users/cuilinhao/.ssh/id_rsa already exists.
Overwrite (y/n)? y
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/cuilinhao/.ssh/id_rsa.
Your public key has been saved in /Users/cuilinhao/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:Esw8wwq5KB5HXw5ee4PuOwdOo/N9TGJ2cc80vCO7SBg cuilinhao
The key's randomart image is:
+---[RSA 2048]----+
| |
| . = |
| o. .Oo . |
| ..oo.=+o . . + |
|o....o.+SE o + o|
|o o .=.++o . = |
| . +.=.=. o .|
| o.o...o.. |
| o++... ..
+----[SHA256]-----+
cuilinhaodeMacBook-Pro:~ cuilinhao$ defaults write com.apple.finder AppleShowAllFiles -bool YES
cuilinhaodeMacBook-Pro:~ cuilinhao$ cd /Users/cuilinhao/.ssh
cuilinhaodeMacBook-Pro:.ssh cuilinhao$ more id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDip6FABjmnHO4jWhorHnCPlNvHUq9BNXQemP0R15lxHZURZL5fp5hsupaPumROP2nzJ5/+M6EOnXFsvVIjfA1lP/+k+8+Ibzlio2Pnqab4R2FHjMZSaHTV0sZ1XqlUiaAaiLoLo2Q81k0BnxdnDcBlMGk+e0RPgYlm99y4OrEWERL7BB7YobG++LNwAVqy1CYDF8KhUkR3xS3hCAefK5n7hkn4FnFnP2TdLlHGJdypjyPXhDRE3Riy7UzxAfv+bdjx4GPL7te27iCazLPOwi0MJSEsFd+6hYqJp+2sbODS96rqEE/Bk0Fr/kzG/6XXZqd/7pclmy6xoz8RCJ96Y5V cuilinhao
...skipping...
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDip6FABjmnHO4jWhorHnCPlNvHUq9BNXQemP0R15lxHZURZL5fp5hsupaPumROP2nzJ5/+M6EOnXFsvVIjfA1lP/+k+8+Ibzlio2Pnqab4R2FHjMZSaHTV0sZ1XqlUiaAaiLoLo2Q81k0BnxdnDcBlMGk+e0RPgYlm99y4OrEWERL7BB7YobG++LNwAVqy1CYDF8KhUkR3xS3hCAefK5n7hkn4FnFnP2TdLlHGJdypjyPXhDRE3Riy7UzxAfv+bdjx4GPL7te27iCazLPOwi0MJSEsFd+6hYqJp+2sbODS96rqEE/Bk0Fr/kzG/6XXZqd/7pclmy6xoz8RCJ96Y5V cuilinhao
到此就生成了瓣戚,直接復(fù)制過去就可以了
=====================
~
cuilinhaodeMacBook-Pro:.ssh cuilinhao$
cuilinhaodeMacBook-Pro:.ssh cuilinhao$ cd /Users/cuilinhao/Desktop/aaaa
cuilinhaodeMacBook-Pro:aaaa cuilinhao$ git clone https://github.com/cuilinhao/-Demo.git
Cloning into '-Demo'...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 3
Unpacking objects: 100% (3/3), done.
cuilinhaodeMacBook-Pro:aaaa cuilinhao$ git add .
warning: adding embedded git repository: Desktop/aaaa/-Demo
hint: You've added another git repository inside your current repository.
hint: Clones of the outer repository will not contain the contents of
hint: the embedded repository and will not know how to obtain it.
hint: If you meant to add a submodule, use:
hint:
hint: git submodule add <url> Desktop/aaaa/-Demo
hint:
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint:
hint: git rm --cached Desktop/aaaa/-Demo
hint:
hint: See "git help submodule" for more information.
cuilinhaodeMacBook-Pro:aaaa cuilinhao$ git add .A
fatal: pathspec '.A' did not match any files
cuilinhaodeMacBook-Pro:aaaa cuilinhao$ cd /Users/cuilinhao/Desktop/aaaa/-Demo
cuilinhaodeMacBook-Pro:-Demo cuilinhao$ git add -A
cuilinhaodeMacBook-Pro:-Demo cuilinhao$ git commit -m "aaa"
[master 0272f3a] aaa
1 file changed, 596 insertions(+)
create mode 100644 "\346\255\243\345\210\231\350\241\250\350\276\276\345\274\217.rtf"
cuilinhaodeMacBook-Pro:-Demo cuilinhao$