使用【SSH 密钥】方式访问git

本文以阿里云代码托管为例。

阿里代码托管网址:https://code.aliyun.com

阿里公钥设置网址:https://code.aliyun.com/profile/keys

Windows生成公私钥

在cdm命令窗口输入

ssh-keygen

连按三次回车,结果如下。(三次回车分别对应,文件名,密码,建议都使用默认值,特别是密码,否则,每次使用git都会要求输入密码)

查看公钥

用记事本打开文件【C:\Users\x1c\.ssh\id_rsa.pub】并配置到阿里代码托管中,或者发送给git管理员。

阿里代码托管配置

https://code.aliyun.com/profile/keys

扫描二维码关注公众号,回复: 9506621 查看本文章

Max生成公私钥

Max是自带SSH命令的。

查看是否安装ssh命令

$ whereis ssh

ssh对应的进程

$ ps aux | grep ssh

查看本地是否存在SSH-Key

$ ls -al ~/.ssh

如果不存在目录则需要生成sshkey

$ ssh-keygen -t rsa -C "[email protected]"

发布了29 篇原创文章 · 获赞 5 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/chyercn/article/details/97261044