Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

GitPython: git push --mirror #1246

Answered by Byron
AlexandreODelisle asked this question in Q&A
Discussion options

Context:

I want to migrate repository from one SCM provider to an other.. yet I can't use the built-in import repository tools since they can't talk to each other..

I am able to implement it in bash via git commands, but the whole migration is written in Python.

repo = Repo.clone_from(url=f"{url}",
 to_path=f"{local_path}", bare=True, mirror=True, recursive=True)

Yet, when I use the flag mirror=True in the the git.remote.push() . I don't have the push completed.

remote = repo.create_remote("remote", url=f"{new_url}")
remote.push(mirror=True)

Wondering if it is just not implemented, or I use it wrong.

Thanks!

You must be logged in to vote

GitPython can have a few surprises and in order to avoid that, you could exclusively rely on calling repo.git.... as a handle to the underlying git command.

remote.push(...) provides access to parsed progress information, but if that is not used there isn't much value in it at all.

Why hooks didn't work as expected I don't know - ultimately it calls the git command.

proc.wait(stderr=stderr_text)

Replies: 2 comments

Comment options

Hm, I think I got it..

There was a hook defined blocking the push... but why wasn't I see it as an exception .

You must be logged in to vote
0 replies
Comment options

GitPython can have a few surprises and in order to avoid that, you could exclusively rely on calling repo.git.... as a handle to the underlying git command.

remote.push(...) provides access to parsed progress information, but if that is not used there isn't much value in it at all.

Why hooks didn't work as expected I don't know - ultimately it calls the git command.

proc.wait(stderr=stderr_text)
You must be logged in to vote
0 replies
Answer selected by AlexandreODelisle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /