Verified Commit 65996a98 authored by Sofus Rose's avatar Sofus Rose

Creating existing remote failed.

parent 03cdb5c7
......@@ -24,14 +24,18 @@ def foo():
repo_path = "/opt/git-repos/{}".format(proj_name)
#Initialize & prepare repo object.
repo = Repo(repo_path) if os.path.isdir(repo_path) else Repo.clone_from(gitlab_link, repo_path)
if os.path.isdir(repo_path) :
repo = Repo(repo_path)
github = repo.remotes.github
gitlab = repo.remotes.origin
else :
repo = Repo.clone_from(gitlab_link, repo_path)
github = repo.create_remote('github', github_link)
gitlab = repo.remotes.origin
#Get remotes, pull and push.
github = repo.create_remote('github', github_link)
gitlab = repo.remotes.origin
for branch in repo.branches :
repo.git.checkout('HEAD', b=branch)
repo.git.checkout(branch)
gitlab.pull()
github.push()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment