Created
February 16, 2022 13:37
-
-
Save tadeubdev/f6c1412ffb5894633e73acc652826a50 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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