Skip to content

Instantly share code, notes, and snippets.

@yoursamlan
Last active April 29, 2022 10:16
Show Gist options
  • Save yoursamlan/08ce7b63ce2c8f894c2583281fd40f9b to your computer and use it in GitHub Desktop.
Save yoursamlan/08ce7b63ce2c8f894c2583281fd40f9b to your computer and use it in GitHub Desktop.
import datetime,time
from git import Repo
from tqdm import tqdm
PATH_OF_GIT_REPO = r'C:\Users\path\to\git\dir\.git' # make sure .git folder is properly configured
def git_push():
try:
repo = Repo(PATH_OF_GIT_REPO)
repo.git.add(update=True)
repo.index.commit(COMMIT_MESSAGE)
origin = repo.remote(name='origin')
origin.push()
#print(COMMIT_MESSAGE)
except:
print('Some error occured while pushing the code')
while True:
t = datetime.datetime.now()
COMMIT_MESSAGE = 'Last updated at '+ str(t)
git_push()
for _ in tqdm(range(30),desc=COMMIT_MESSAGE):
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment