Skip to content

Python script to make changes and automatically git push

License

Notifications You must be signed in to change notification settings

sebacampos/cronGit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cronGit

Python script to automatically make changes and git add/commit/push.

Triggered via crontab & runned within virtualenv (with dependencies)

Script will do:

  1. Make changes: Add new line in txt file
  2. Git auto add/commit/push

Requirements

  1. pip:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
  1. virtualenv, according to your installed python version:

Python 2.7x: pip install virtualenv

Python 3x: pip3 install virtualenv

or simply: python -m pip install virtualenv

Setup:

  1. Meet requirements
  2. Clone repo
  3. Create virtualenv with virtualenv cronGitEnv
  4. Activate env: source cronGitEnv/bin/activate
  5. Install dependencies inside the virtualenv (cronGitEnv) pip install Gitpython
  6. Setup crontab with crontab -e
  7. Press i to edit
  8. Paste the following to activate the env & run the python script at minute 0 every 4hs. (Check path to match with your local path)
SHELL=/bin/bash
0 */4 * * * cd projects/cronGit/cronGitEnv && source bin/activate && cd .. && python index.py

Credits

Forked from ospiegel91/cronGit

Medium

About

Python script to make changes and automatically git push

Topics

Resources

License

Stars

Watchers

Forks

Languages