Technology

Automate Git Clone Operations Using Python

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" 
Sabin Jn
More than 10+years of rich experience in Software Configuration Management domain.Focus to help teams in shaping SCM best practices to achieve quality in software deliveries.Expertise as a CI/CD specialist for DEVOPS organisations

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.