简介
![](https://i-blog.csdnimg.cn/direct/5bee1c973fe34b28ab4dcd5493cb4190.png)
一、如何安装git
使用gitee,需要先安装git工具。
工具网站地址:https://git-scm.com/downloads
![](https://i-blog.csdnimg.cn/direct/614497e560ca43b98e3882289bc38a72.png)
安装完成后,在terminal命令行输入git --version
可以查看到git
的版本。
![](https://i-blog.csdnimg.cn/direct/58a91d52d44b4ac596e853b257d59783.png)
二、登录gitee
我们先在 gitee
上注册账号并登录。
gitee
官网:Gitee - 基于 Git 的代码托管和研发协作平台
三、使用SSH公钥
由于我们的本地 git
仓库和 gitee
仓库之间的传输是通过SSH
加密的,所以我们需要配置SSH
公钥。
打开终端:输入ssh-keygen -t rsa -C "xxxxxxxxxxxxx"
# xxxxxxxxx
只是生成的 sshkey 的名称
![](https://i-blog.csdnimg.cn/direct/4042ad5084054858964754f7d61abb5d.png)
![](https://i-blog.csdnimg.cn/direct/51a97ebf77434fb6b08b314f88d8f7d8.png)
![](https://i-blog.csdnimg.cn/direct/8a6b72794eec400c8dd8880eb545c053.png)
按照提示完成三次回车,即可生成ssh key
。
可以看到,我们生成的公钥文件id_rsa.pub
路径:C:\Users\77653/.ssh/id_rsa.pub
![](https://i-blog.csdnimg.cn/direct/82ce82873aa84e55af0edd80e4636997.png)
四、配置SSH公钥
在gitee
网站点击账号设置
![](https://i-blog.csdnimg.cn/direct/3ddc830e0a314dad8288f4098417c604.png)
输入公钥标题,拷贝刚刚的SSH
公钥到框中,点击确定
![](https://i-blog.csdnimg.cn/direct/889ebbe9461f4dd1bb8f9a79867a6ea7.png)
五、创建仓库
![](https://i-blog.csdnimg.cn/direct/3cb6f69d5c054dc88139753ec8d59d6a.png)
![](https://i-blog.csdnimg.cn/direct/f9badbbea3ce4cc2892f94b288c56a91.png)
六、命令讲解
Git 全局设置:
git config --global user.name "qiqi1257"
git config --global user.email "776000001@qq.com"
![](https://i-blog.csdnimg.cn/direct/2f089393f5ef4b668153fb71cb3f2bc9.png)
![](https://i-blog.csdnimg.cn/direct/01d3b8fa28b84641ac78a56090c27d34.png)
![](https://i-blog.csdnimg.cn/direct/35b4a7b319ce4c00909b3c781074a90e.png)
![](https://i-blog.csdnimg.cn/direct/e1bca5224a744930a5cc6f0811934c1d.png)
![](https://i-blog.csdnimg.cn/direct/c9c5983b55074d16aff66080d8e3beb0.png)
总的来说就是:
创建一个工作目录---格式化这个目录---创建代码文件---将代码文件添加到暂存区---再把代码文件添加到远程仓库
七、删除仓库
![](https://i-blog.csdnimg.cn/direct/f682f0204f8a4847975af302d8850b43.png)