使用SSH方式上传/下载项目
在注册github账号和下载git之后,可以通过配置SSH对远程仓库进行使用。
一.生成SSH key
-
打开Git Bash
![学新通 学新通](/static/whole/images/alert/data-load/load-15.gif)
-
粘贴如下的命令,并将your_email@example.com替换为注册Github账号时填写的邮箱:ssh-keygen -t rsa -b 4096-C "your_email@example.com"
![学新通 学新通](/static/whole/images/alert/data-load/load-15.gif)
3.连续敲击3次回车,即可在C:\Users\用户名文件夹\.ssh目录中生成id_rsa和id_rsa.pub两个文件
![学新通 学新通](/static/whole/images/alert/data-load/load-15.gif)
![学新通 学新通](/static/whole/images/alert/data-load/load-15.gif)
二.配置SSH
1.使用记事本打开id_rsa.pub文件,复制里面的文本内容在浏览器中登录Github,点击头像-> Settings
->sSH and GPG Keys -> New SSH key
![学新通 学新通](/static/whole/images/alert/data-load/load-15.gif)
2.将id_rsa.pub文件中的内容,粘贴到Key对应的文本框中
3.在Title文本框中任意填写一个名称,来标识这个
4.Key 从何而来
![学新通 学新通](/static/whole/images/alert/data-load/load-15.gif)
成功之后显示如下:
![学新通 学新通](/static/whole/images/alert/data-load/load-15.gif)
三.检测Github 的SSH key是否配置成功
1.打开Git Bash,输入如下的命令并回车执行:
ssh -T git@github.com
-
上述的命令执行成功后,可能会看到如下的提示消息:
-
The authenticity of host 'github.com (IP ADDRESS)' can't be established.
-
RSA key fingerprint is SHA256:nThbg6kXUpJMG17E1IGOCspRomTxdCARLviKw6E5SY8.
-
Are you sure you want to continue connecting (yes/no)?
输入 yes之后,如果能看到类似于下面的提示消息,证明SSH key 已经配置成功了:
-
Hi username!You've successfully authenticated, but GitHub does not
-
provide shell access.
成功后显示:
![学新通 学新通](/static/whole/images/alert/data-load/load-15.gif)
四.基于SSH将本地仓库上传到Github
-
将写好的项目使用git进行管理
-
git init
-
git add .
-
git commit - m "初始化项目"
2.在github中新建一个仓库
![学新通 学新通](/static/whole/images/alert/data-load/load-15.gif)
![学新通 学新通](/static/whole/images/alert/data-load/load-15.gif)
![学新通 学新通](/static/whole/images/alert/data-load/load-15.gif)
执行成功后:
![学新通 学新通](/static/whole/images/alert/data-load/load-15.gif)
五.将远程仓库克隆到本地
打开Git Bash,输入如下的命令并回车执行:
git clone 远程仓库的地址
选择一个项目,点击code,选择SSH模式下的项目地址
![学新通 学新通](/static/whole/images/alert/data-load/load-15.gif)
在git中输入git clone "项目地址"
![学新通 学新通](/static/whole/images/alert/data-load/load-15.gif)
即可将项目克隆到本地。
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /boutique/detail/tanhiaakib
系列文章
更多
同类精品
更多
-
photoshop保存的图片太大微信发不了怎么办
PHP中文网 06-15 -
word里面弄一个表格后上面的标题会跑到下面怎么办
PHP中文网 06-20 -
photoshop扩展功能面板显示灰色怎么办
PHP中文网 06-14 -
《学习通》视频自动暂停处理方法
HelloWorld317 07-05 -
TikTok加速器哪个好免费的TK加速器推荐
TK小达人 10-01 -
Android 11 保存文件到外部存储,并分享文件
Luke 10-12 -
微信公众号没有声音提示怎么办
PHP中文网 03-31 -
excel下划线不显示怎么办
PHP中文网 06-23 -
微信运动停用后别人还能看到步数吗
PHP中文网 07-22 -
excel打印预览压线压字怎么办
PHP中文网 06-22