武器库篇之Git创建远程仓库和建立SSH key 免密登陆(三十七)
Git是一种版本控制系统,用于跟踪文件的更改和协调多人开发项目。它可以记录文件的历史更改,协助多人协作开发,并提供分支管理功能。Git是一个分布式系统,意味着每个人在自己的本地计算机上都有一份完整的代码仓库,并且可以独立地进行工作。它具有速度快、灵活和强大的功能,被广泛用于软件开发和项目管理。
首先我们进入Git的官方网站,点击Download fot Windows下载相应的版本的安装程序,进行安装

或者在Linux系统上使用 git -v
检查当前操作系统是否安装了 Git

创建远程仓库
要在Git上创建远程仓库,你需要以下步骤:
在Git托管服务(如GitHub、GitLab、Bitbucket等)上创建新的仓库。在仓库创建页面上,你通常会看到一个"New Repository"(新建仓库)的按钮或类似的选项。点击该按钮并根据提示输入仓库名称、描述等信息。

然后我们去创建一个仓库,输入存储库的名称,点击创建存储库创建仓库

然后我们就成功创建了一个仓库

建立SSH key 免密登陆
然后我们来设置SSH key 进行免密登陆,首先在Kali 系统中输入如下的命令获取免密登陆的文件
bash
ssh-keygen -t rsa

使用命令后,会在相应的目录下生成一个隐藏的目录,我们进入到这个目录中
bash
cd /root/.ssh

然后我们回到 Github 点击 Settings 设置

继续点击 SSH and GPG keys

继续点击 New SSH key,添加新的 SSH 密钥

接着会进入如下的界面

回到我们的Kali 机器上,复制我们刚刚生成的公钥,就是 id_rsa.pub 这个文件

将这个文件的内容复制粘贴到 Key 的文本内容框中,点击 Add SSH key

然后我们就完成了添加新的 SSH 密钥

然后我们输入以下的命令来测试是否能和github的仓库进行远程通讯
bash
ssh -T git@github.com

如上图,显示 Hi lirenshang! You've successfully authenticated, but GitHub does not provide shell access. 现在我们已经成功进行 SSH key 免密登陆