Skip to content

Instantly share code, notes, and snippets.

@tadeubdev
Created February 16, 2022 13:37
Show Gist options
  • Save tadeubdev/f6c1412ffb5894633e73acc652826a50 to your computer and use it in GitHub Desktop.
Save tadeubdev/f6c1412ffb5894633e73acc652826a50 to your computer and use it in GitHub Desktop.
const fs = require('fs');
const baseUrl = 'root@{ip}';
// get all git directories in the current directory
const gitDirs = fs.readdirSync('./').filter(dir => fs.statSync(dir).isDirectory() && fs.existsSync(`${dir}/hooks`));
const pwd = process.cwd();
gitDirs.forEach(dir => {
const name = dir.toString().replace('.git', '');
const url = `${baseUrl}:${pwd}/${dir}`;
console.log(`git remote add ${name} ${url}`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment