1.安裝git 指令-> yum install git 。
2.生成本地秘鑰 指令-> ssh-keygen -t rsa -C " $your_email "
3.在碼雲中存入本地秘鑰 (/root/.ssh/id_rsa.pub.)秘鑰位置
4.初始化git 指令-> git init
5.檢測初始化 指令-> ls -la 檢視 .git 檔案是否存在
6.關聯碼雲git項目(添加遠端倉庫) git remote add origin $your_SSH
7.配置本地git賬戶 git config --global user.email " [email protected] " 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了。