1 安装git

yum install -y git

2 生成证书


(资料图片仅供参考)

ssh-keygen -t rsa

3 上传证书

vim /root/.ssh/id_rsa.pub

github→setting→SSH keys

4 配置

cd /home/www/admin

git config --global user.name "hu-changyi"

git config --global user.email 584543022@qq.com

5 git仓库初始化

rm -rf ./.git

git init

6 add目录或文件

vim .gitignore

git add ./*

7 commit提交并备注

git commit -m "first commit"

8 新建分支

git branch -M main

9 远程提交

git remote add origin https://github.com/hu-changyi/admin.git

git push -u origin main

git remote remove origin

git remote add origin git@github.com:hu-changyi/admin.git

git push -u origin main

10 windows端

需注意clone时需要输入yes确认

推荐内容