我使用gitPython
将登录到我们应用程序的不同用户推送到远程回购。在
目前,我只需推动回购,如下所示:
logging.debug('Opening repo {}...'.format(repo_path))
repo = Repo(repo_path)
logging.debug('Repo is initialized :)')
logging.debug('git add: {} {}'.format(env, file_name))
repo.git.add(file_path)
commit_message = "Add new configs for {}".format(file_name)
logging.debug(commit_message)
repo.git.commit(commit_message)
repo.git.pull('origin', 'refs/heads/dev')
repo.git.push('origin', 'refs/heads/dev')
我的ssh配置中git用户有不同的用户,如果这有帮助:
^{pr2}$现在我想推送特定的用户。每个登录到我们应用程序的用户都有一个不同的git用户。有可能吗?如何解决这个问题?在
是的,这是可能的,您只需使用远程
origin
,而不是使用SSH URL您需要构建包含以下内容的远程url:
所以你的
^{pr2}$repo.git.push('origin', 'refs/heads/dev')
变成:相关问题 更多 >
编程相关推荐