29 lines
806 B
JavaScript
29 lines
806 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 all files ===');
|
|
execSync(`${gitPath} commit -m "Add full huishou project"`, { stdio: 'inherit', cwd: __dirname });
|
|
|
|
console.log('=== Push to remote ===');
|
|
const env = { ...process.env };
|
|
env.GIT_SSH_COMMAND = 'ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null';
|
|
|
|
execSync(`${gitPath} push origin master`, {
|
|
stdio: 'inherit',
|
|
cwd: __dirname,
|
|
env: env
|
|
});
|
|
|
|
console.log('=== Success ===');
|
|
|
|
} catch (error) {
|
|
console.error('=== Failed ===');
|
|
console.error('Exit code:', error.status);
|
|
console.error(error.message);
|
|
}
|