Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to read from a remote git repository using python?

Tags:

git

python

Is it possible to read directly from git repository using python? I tried using git-python but it reads from local git repository only.

like image 931
user2554809 Avatar asked May 02 '26 22:05

user2554809


1 Answers

The only git-python command which may let you query commits without cloning/fetching first would be ls_remote.

You can see an example in test/lib/helper.py#L168-179:

rw_repo.git.ls_remote(d_remote)

But that will return only the commits representing the branches/HEADS of a remote repo.

For any other history, you need to clone that remote repo first.

like image 177
VonC Avatar answered May 04 '26 12:05

VonC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!