shell脚本一键同时推送代码至github和gitee
生活随笔
收集整理的這篇文章主要介紹了
shell脚本一键同时推送代码至github和gitee
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
自己寫的東西,要同時推送多個git地址,解決辦法如下:
?
1.先要初始化你的git
? ? ? ? ? ? ?進入自己的項目目錄,然后執行 git? init
cd /app/code/go-study git init?
2.執行以下腳本:
#!/bin/bash #author Oliver #since 2020-09-03 15:24:31git remote rm origin #replace your git location git remote add origin 'https://github.com/**********' git pull remote master git add . git commit -m $1 git push origin master --force if [ "$?" = "0" ] thenecho -e "\033[42;34m push to github success! \033[0m" elseecho -e "\033[41;30m push to github fail! \033[0m"exit 1 figit remote rm origin #replace your git location git remote add origin 'https://gitee.com/**********' git pull remote master git add . git commit -m $1 git push origin master --forceif [ "$?" = "0" ] thenecho -e "\033[42;34m push to gitee success! \033[0m" elseech -e "\033[41;30m push to gitee fail! \033[0m"exit 1 fi?
3.執行shell腳本,可以傳一個參數是git 的提交的msg:
./shell.sh "提交代碼"?
總結
以上是生活随笔為你收集整理的shell脚本一键同时推送代码至github和gitee的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: CAD快速看图软件中孔轴投影教程
- 下一篇: Php Laravel框架 多表关系处理