使用git自动将子工程发布到百度开放云上

我的项目中包含多个子工程,如web工程、python工程等。我在项目的根目录下建立了git管理,因此如果使用git push只能把整个项目推送上去,但我只想推送web工程目录。因此,编写了cmd脚本如下:

set GIT="D:Program Files (x86)Gitingit"
set CURRENT_DIR="E:ProjectUploadToBAE"
set SRC_DIR="E:ProjectWebProject"
set SWAP_DIR="E:ProjectSwapDir"
set USERNAME=yourusername
set PASSWORD=yourpassword
set APPID=yourappid

xcopy %SRC_DIR% %SWAP_DIR% /e /y
cd /d %SWAP_DIR%
%GIT% init
%GIT% config --global user.email "turtlegood@163.com"
%GIT% config --global user.name "turtlegood"
%GIT% add .
%GIT% commit -a -m "Auto Commit"
%GIT% push https://%USERNAME%:%PASSWORD%@git.duapp.com/%APPID% master -f
cd /d %CURRENT_DIR%
del /f /s /q %SWAP_DIR%
rd /q /s %SWAP_DIR%

其中你需要修改的就是上面一大堆set的东西。那个appid指的是百度开放云中你的git地址最后面的一堆字母

原文地址:https://www.cnblogs.com/turtlegood/p/4753814.html