1:Mac电脑生成ssh密匙
命令行输入:
ssh-keygen -t rsa -C "你的github邮箱"
回车:
- Generating public/private rsa key pair.
- Enter file in which to save the key (/Users/mac/.ssh/id_rsa):
- Enter passphrase (empty for no passphrase):
- Enter same passphrase again:
- Your identification has been saved in /Users/mac/.ssh/id_rsa.
- Your public key has been saved in /Users/mac/.ssh/id_rsa.pub.
- The key fingerprint is:
- SHA256:1vO3ou0+VwPi632vsuRxx/AE4IZfkkWM8AjtZioWqcU xxxx@gmail.com
- The key's randomart image is:
- +---[RSA 2048]----+
- | .....+o |
- | ..=.+. |
- | . . .o * o |
- | E .++ + . |
- | o .S++ o o .|
- | . o.. + *.|
- | . . = o.=|
- | ==+.+ |
- | o=*B+.o|
- +----[SHA256]-----+
---------------------------------------------
生成的ssh会保存在.ssh文件夹中(一般为隐藏文件,用户根目录下)。
打开.ssh文件夹下的id_rsa.pub这个文件,将文件中的内容复制到github 》account setting 》SSH Keys 》Add SSH Key中。
在github上新建一个文件仓库
然后xcode就可以checkout github的仓库到本地中,在本地仓库新建一个iOS项目,最后 在xcode commit -》 push就可以到github上了。
中间有需要github的仓库地址,用户密码等省略了。