saveGit.js 479 B

1234567891011121314151617181920212223242526
  1. const { execSync } = require("child_process");
  2. (async function Init() {
  3. /**
  4. * 上传git
  5. */
  6. function execFun() {
  7. try {
  8. execSync("git pull");
  9. execSync("git add .");
  10. execSync('git commit -m "提交"');
  11. execSync("git push");
  12. console.log("上传git---完成");
  13. } catch (e) {
  14. console.log("上传git---失败");
  15. console.error(e);
  16. }
  17. }
  18. try {
  19. execFun();
  20. } catch (err) {
  21. console.log("失败", err);
  22. }
  23. })();