

For this we can do the following: (gitpython) /home/knoldus/clone GitPython can also work with remote repository directly but for our simplicity we are using above local repository which we cloned in our system.Ĭopy the location where we saved the cloned repository because we need to tell GitPython which repository to handle. So in clone_from methods pass the two arguments in which first argument is url of your repository and second argument is the location of your directory where you want to cloned the repo. Repo.clone_from("", "/home/knoldus/clone") (gitpython) vim gitclone.py from git import Repo We can use git module in python to clone the repository from git.Ĭlone the repository you want to work with in local system.

(gitpython) installing the GitPython now start writing script to interacting with Git repositories.

Successfully installed GitPython-3.1.8 gitdb-4.0.5 smmap-3.0.4 Installing collected packages: smmap, gitdb, GitPython
PYTHON GIT CREATE BRANCH INSTALL
You can also specify the GitVersion available as pip install GitPython=2.1.7 but by default it install the latest version. (gitpython) activating the virtualenv, it’s time to install GitPython using pip command. If virtual environment activated then its name is prepended to the command prompt as shown below: python3 -m venv source gitpython/bin/activate Secondly, activate the newly created virtualenv. My virtualenv is named testgitpython but you can name according to yourself.
