Skip to content

Instantly share code, notes, and snippets.

@vadviktor
Created February 18, 2019 12:56
Show Gist options
  • Select an option

  • Save vadviktor/1fcda00e566d4bc05db2ca4fd17f455d to your computer and use it in GitHub Desktop.

Select an option

Save vadviktor/1fcda00e566d4bc05db2ca4fd17f455d to your computer and use it in GitHub Desktop.
Sync repos from Github
"""
https://gitpython.readthedocs.io/en/stable/index.html
"""
import shutil
from git import Repo
repos = {
"github": "[email protected]:vadviktor/test.git",
"gitlab": "[email protected]:vadviktor/test.git",
"bitbucket": "[email protected]:vadviktor/test.git"
}
repopath = './t'
# shutil.rmtree(repopath, ignore_errors=True)
repo = Repo.init(repopath, bare=True)
# for k, v in repos.items():
# repo.create_remote(k, v, mirror="fetch")
repo.remote("github").fetch()
repo.remote("gitlab").push("--all")
repo.remote("bitbucket").push("--all")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment