1

I am writing a script that clones and pushes something to the repository on gitlab. The thing is I have to clone to a specific directory on the filesystem and push from the same directory the project is cloned to. I managed to solve my issue, but I'm having a question regrading functionality with cloning and pushing via GitPython.

I followed this answer to clone a repository:

https://stackoverflow.com/a/2472616

The person that answered also linked the following documentation and stated that their solution isn't nice:

https://gitpython.readthedocs.io/en/stable/tutorial.html https://gitpython.readthedocs.io/en/stable/reference.html#git.repo.base.Repo.clone

git.Git("../target/.").clone(f"{ repo }")

This worked wonderfully...but I couldn't find this in the documentation. What is this .Git part? Where can I find this in the code of the library? I am quite new to Python and I would like to figure out how is this implemented.

I have managed to push in the same way:

git.Git(f"../target/{ app_name }").add(".")
git.Git(f"../target/{ app_name }").commit("-m", "Update")
git.Git(f"../target/{ app_name }").push()
torek
  • 448,244
  • 59
  • 642
  • 775
JBravo
  • 48
  • 5

1 Answers1

1
git.Git(...) 

is the same as

git.cmd.Git(...)

You can find what it does here: https://gitpython.readthedocs.io/en/stable/reference.html#module-git.cmd

Daniel Bl
  • 36
  • 1