saveGit.js 451 B

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