def add_remote(path, name, remote_url, use_sudo=False, user=None, fetch=True):
 if (path is None):
  raise ValueError('Path to the working copy is needed to add a remote')
 if fetch:
  cmd = ('git remote add -f %s %s' % (name, remote_url))
 else:
  cmd = ('git remote add %s %s' % (name, remote_url))
 with cd(path):
  if (use_sudo and (user is None)):
   run_as_root(cmd)
  elif use_sudo:
   sudo(cmd, user=user)
  else:
   run(cmd)

def add_remote ( path , name , remote_url , use_sudo = False , user = None , fetch = True ) : if ( path is None ) : raise ValueError ( 'Path to the working copy is needed to add a remote' ) if fetch : cmd = ( 'git remote add -f %s %s' % ( name , remote_url ) ) else : cmd = ( 'git remote add %s %s' % ( name , remote_url ) ) with cd ( path ) : if ( use_sudo and ( user is None ) ) : run_as_root ( cmd ) elif use_sudo : sudo ( cmd , user = user ) else : run ( cmd )
add a remote git repository into a directory .