作者:秋林学士_809 | 来源:互联网 | 2023-10-12 14:20
两种模式:httpsVSsshssh模式比https模式的一个重要好处就是,每次push、pull、fetch等操作时,不用重复填写遍用户名密码。前提是你必须是这个项目的拥有者或者
两种模式:https VS ssh
- ssh模式比https模式的一个重要好处就是,每次push、pull、fetch等操作时,不用重复填写遍用户名密码。
- 前提是你必须是这个项目的拥有者或者合作者,且配好了ssh key
如何配置SSH key
步骤1:检查你的电脑上是否已经生成了SSH Key 在git bash下执行如下命令

如果已经有这个文件包 删除就行了
步骤2:创建SSH Key: ssh-****** -t rsa -C [email protected](你的GitHub账号的邮箱)
成功的话会在~/下生成.ssh文件夹,进去,打开id_rsa.pub,复制里面的key。

步骤3:进入.ssh文件包,打印id_rsa.pub的内容,复制全部内容

步骤4.登录Github后,右上角点击setting

步骤5.在左侧菜单中选择SSH and GPG keys,在右边点击New SSH key

步骤6 :Title随便写,Key 把之前id_rsa.pub的内容复制进去,点击Add SSH key,设置ssh key 完成。

测试连通性:要改用ssh连接


要建立新的远程代号
- git remote add originssh [email protected]:yuebuqun777888/bixiejianfa.git
- 以后再提交代码的时候就不用输入密码了(第一次使用会要求输入个 yes)
- git push originssh master