const { execSync } = require("child_process"); (async function Init() { /** * 上传git */ function execFun() { try { execSync("git add ."); execSync('git commit -m "提交"'); execSync("git push"); console.log("上传git---完成"); } catch (e) { console.log("上传git---失败"); console.error(e); } } try { execFun(); } catch (err) { console.log("失败", err); } })();