mac 系统开始就已经为我们安装了ssh 如果没有安装,
首先安装打开终端:$ ssh -v
查看ssh版本
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
[-D [bind_address:]port] [-e escape_char] [-F configfile]
[-I pkcs11] [-i identity_file]
[-L [bind_address:]port:host:hostport]
[-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
[-R [bind_address:]port:host:hostport] [-S ctl_path]
[-W host:port] [-w local_tun[:remote_tun]]
[user@]hostname [command]
这个表明ssh已经安装.
如果没有安装,在终端输入以下命令
$ ssh-keygen -t rsa -C "youremail@example.com"
一路回车确定下就安装好了。
生成在当前用户名下会有一个.sh文件。
查看 .ssh
切换到电脑的用户名下执行如下命令
$ ls -a ~/.ssh 通过搜索目录
id_rsa
id_rsa.pub
打开 id_rsa.pub文件 里面就有需要的ssh key。
在终端输入命令打开id_rsa.pub
vim ~/.ssh/id_rsa.pub
将.pub中的多有内容拷贝出来填到git账户里面就ok了
Back in your terminal window, copy the contents of your public key file.
For example, in Linux you can cat the contents.
$ cat ~/.ssh/id_rsa.pub
In Mac OSX, the following command copies the output to the clipboard:
$ pbcopy < ~/.ssh/id_rsa.pub
注意:SSH设置完,确定没有错之后实在 不行 重启下电脑可能就生效了 我这里是这样。。。
网友评论