ios 代码上传到github 需要生成ssh

创建SSH Key

  1. $ ssh-keygen -t rsa -C 账户名 //直接各种回车
  2. 在电脑个人用户主目录找到隐藏文件夹 .ssh,打开有id_rsa、id_rsa.pub这两个文件
  3. id_rsa可以直接打开,id_rsa.pub苹果电脑不能打开,可以通过命令 (1)cd ~/.ssh 切换到目录 (2)more id_rsa.pub在终端直接显示出文件内容
C9322798-4062-4AD4-8CF0-ADB057A0F305.png
====

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

到此就生成了,直接复制过去就可以了

=====================

~
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  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$ 

你可能感兴趣的:(ios 代码上传到github 需要生成ssh)