0

I am trying to clone a GitLab repo in a python script using GitPython. I want it to be able to clone this private repo from GitLab without me having to manually input my username and auth token each time I run the script.

I currently have:

from git import

Repo cloned_repo = Repo.clone_from("http://gitlab.com/reponame.git", "path/to/repo")

When I run this it runs the clone command which asks me for my username and password in the command line. I want to just pass that the username and pass to the command within the script or when I run it so this script can run without me interacting with it.

I tried passing the username and pass as parameters when running the program but they were not taken as input.

The solution could also be a python specific trick where I could pass env variables to the program so that when it asks for them it already has them, how could I give the GitPython command those environment variables so that it takes them as input?

mandypea
  • 13
  • 6
  • https://stackoverflow.com/questions/2472552/python-way-to-clone-a-git-repository You should find an answer here – Kobe Apr 05 '22 at 13:50
  • Thanks @Kobe, I found the answer here: https://stackoverflow.com/a/43070129/18200481 – mandypea Apr 05 '22 at 14:13

0 Answers0