Files
huishou/git-push.js
T
2026-07-27 13:46:06 +08:00

21 lines
655 B
JavaScript

const { execSync } = require('child_process');
const gitPath = 'D:\\Git\\bin\\git.exe';
try {
console.log('=== Add all files ===');
execSync(`${gitPath} add .`, { stdio: 'inherit', cwd: __dirname });
console.log('=== Commit code ===');
execSync(`${gitPath} commit -m "Initial commit - huishou project"`, { stdio: 'inherit', cwd: __dirname });
console.log('=== Push to remote ===');
execSync(`${gitPath} push -u origin master`, { stdio: 'inherit', cwd: __dirname });
console.log('=== Success ===');
} catch (error) {
console.error('=== Failed ===');
console.error('Exit code:', error.status);
console.error(error.message);
}