Last active
December 19, 2015 13:09
-
-
Save jayzeng/5960360 to your computer and use it in GitHub Desktop.
mat remote
This file contains hidden or 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
#!/usr/bin/python | |
import subprocess | |
devs = {} | |
devs['jayzeng'] = 'jayzeng' | |
devs['niek'] = 'nieksand' | |
devs['lee'] = 'leehasoffers' | |
devs['lucas'] = 'lucasoffers' | |
devs['josh'] = 'joshs633' | |
devs['jack'] = 'jackofseattle' | |
devs['charles'] = 'charlesgardiner' | |
devs['kevin'] = 'kevin-hasoffers' | |
devs['nick'] = 'rushton' | |
devs['johnny'] = 'Johnny-Malizia' | |
# retrieve local username | |
whoami_cmd = subprocess.Popen(['whoami'], stdout=subprocess.PIPE) | |
local_username, err = whoami_cmd.communicate() | |
local_username = local_username.strip('\n') | |
for dev_name, dev_alias in devs.iteritems(): | |
repos = ['app', 'api', 'schema'] | |
for repo in repos: | |
base_repo = ('/data/www/%s') % repo | |
# set remote to match your username | |
if local_username in dev_name: | |
origin_alias = ('[email protected]:%s/%s.git') % (dev_alias, repo) | |
subprocess.Popen(['/usr/bin/git', 'remote', 'set-url', 'origin', origin_alias], cwd=base_repo) | |
prod_alias = ('[email protected]:Adapp/%s.git') % repo | |
repo_alias = ('[email protected]:%s/%s.git') % (dev_alias, repo) | |
subprocess.Popen(['/usr/bin/git', 'remote', 'add', dev_name, repo_alias], cwd=base_repo) | |
subprocess.Popen(['/usr/bin/git', 'remote', 'add', 'prod', prod_alias], cwd=base_repo) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment