简介
可以通过配置秘钥的方式通过命令行访问gitlab和github
生成秘钥
ssh-keygen -t rsa -C "fairy@gmail.com"
在本地生成秘钥后,把id_rsa.pub文件内容拷贝到gitlab或者github的配置秘钥的地方即可
配置config
Host github.com
AddKeysToAgent yes
IdentityFile ~/.ssh/id_rsa
测试连通性
ssh -T git@github.com
同步本地代码库到远程仓库
git init //初始化代码库
git add . // 添加本地代码库中文件
git commit -m "update,添加简单的bolt的增删改查等逻辑" // 添加commit
git branch -M main //切换分支
git remote add origin git@github.com:fairylandchern/likebolt.git // 添加远端代码库映射,首先需要在github上建立对应代码库(不确定)
git push -u origin main // 推送本地代码到远程代码库