Initial commit - huishou project
This commit is contained in:
+2
-12
@@ -1,24 +1,13 @@
|
||||
const { execSync } = require('child_process');
|
||||
const fs = require('fs');
|
||||
|
||||
const gitPath = 'D:\\Git\\bin\\git.exe';
|
||||
|
||||
try {
|
||||
console.log('=== Remove lock file ===');
|
||||
const lockFile = 'D:\\Trae\\huishou\\.git\\index.lock';
|
||||
if (fs.existsSync(lockFile)) {
|
||||
fs.unlinkSync(lockFile);
|
||||
console.log('Lock file removed');
|
||||
}
|
||||
|
||||
console.log('=== Add all files ===');
|
||||
execSync(`${gitPath} add .`, { stdio: 'inherit', cwd: __dirname });
|
||||
|
||||
console.log('=== Commit code ===');
|
||||
execSync(`${gitPath} commit -m "Initial commit"`, { stdio: 'inherit', cwd: __dirname });
|
||||
|
||||
console.log('=== Add remote ===');
|
||||
execSync(`${gitPath} remote add origin git@git.torchcloud.cn:jiapengyu/huishou.git`, { stdio: 'inherit', cwd: __dirname });
|
||||
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 });
|
||||
@@ -26,5 +15,6 @@ try {
|
||||
console.log('=== Success ===');
|
||||
} catch (error) {
|
||||
console.error('=== Failed ===');
|
||||
console.error('Exit code:', error.status);
|
||||
console.error(error.message);
|
||||
}
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
const { execSync } = require('child_process');
|
||||
|
||||
try {
|
||||
console.log('=== Testing SSH without host key checking ===');
|
||||
const result = execSync('ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -T git@git.torchcloud.cn', {
|
||||
stdio: ['inherit', 'inherit', 'inherit'],
|
||||
timeout: 30000,
|
||||
cwd: __dirname
|
||||
});
|
||||
console.log('=== SSH connection successful ===');
|
||||
} catch (error) {
|
||||
console.error('=== SSH connection failed ===');
|
||||
console.error('Exit code:', error.status);
|
||||
}
|
||||
Reference in New Issue
Block a user