21.5 C
Bangalore
October 19, 2018
Untitled

Automate Git Clone Operations Using Python

Sabin Jn
import git, os, shutil DIR_NAME = "myrepo" GIT_URL = "https://github.com/rmccue/test-repository.git" if os.path.isdir(DIR_NAME): shutil.rmtree(DIR_NAME) repo = git.Repo.init(DIR_NAME) origin = repo.create_remote('origin',GIT_URL) origin.fetch() origin.pull(origin.refs[0].remote_head) print "Repo Creation Completed"