1.安装git 命令-> yum install git 。
2.生成本地秘钥 命令-> ssh-keygen -t rsa -C " $your_email " /*放入码云email*/
3.在码云中存入本地秘钥 (/root/.ssh/id_rsa.pub.)秘钥位置
4.初始化git 命令-> git init
5.检测初始化 命令-> ls -la 查看 .git 文件是否存在
6.关联码云git项目(添加远程仓库) git remote add origin $your_SSH /*添加码云中SSH链接*/
7.配置本地git账户 git config --global user.email "you@example.com" /*添加个人email*/
git config --global user.name "Your Name" /*添加昵称*/
8.测试初始化
git add --all
git commit -m "初始化"
git pull origin master
git 同步代码
git push origin master 提示 Everything up-to-date 即可
9.电脑上创建远程仓库向 git 代码中加入筛选和执行代码文件( .gitignore 和 redeploy.sh )
10.服务器拉取git git pull origin master
11.测试执行文件 用 sh 执行文件 如 sh redeploy.sh 执行 redeploy.sh 文件。
部署拉取就执行 redeploy.sh 就OK了。