mujtaba1747 / git-autocommit

A bash script to automate pushing changes to github
GNU General Public License v3.0
30 stars 8 forks source link
bash git hacktoberfest hacktoberfest2020 linux

git-autocommit

A bash script to automate pushing changes to github

Image

It Employs inotifywait (a Linux System Call from the inotify family) to recursively watch a directory for changes. Triggers Commands to push changes when they are detected.

This script can be easily modified for any VCS / Cloud provider which provides command-line interface.

Supporting Medium Article : https://medium.com/@mujtaba1747/how-to-learn-linux-and-git-25b18a815778

Before Using :

  1. Make sure git or whatever VCS you're using is configured properly (SSH keys) and you already have cloned the target repo to your local machine.
  2. Make sure you have inotify-tools installed. (if not, Ubuntu users can type : sudo apt-get install inotify-tools) for other Distros : https://github.com/inotify-tools/inotify-tools/wiki
  3. Make sure you have the correct path of the cloned repo in the script.

Using the script :

How to stop the script from running in the background

Important Links for reference :

  1. To add ssh-keys : https://docs.github.com/en/enterprise/2.18/user/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#generating-a-new-ssh-key

  2. Installing inotify-tools and more info : https://github.com/inotify-tools/inotify-tools/wiki

  3. Whats is /dev/null : https://linuxhint.com/what_is_dev_null/

  4. More about the kill command : http://linuxcommand.org/lc3_man_pages/kill1.html (one could go through man kill alternatively)

  5. More about the inotifywait call : https://man7.org/linux/man-pages/man1/inotifywait.1.html (one could go through man inotifywait instead if inotify-tools are installed)

  6. Video Demonstration of the Project : https://www.youtube.com/watch?v=2Gru7rnZRZA

Pull Requests and issues are Welcome !

For any queries feel free reach out : mujtaba1747@gmail.com

One small Caveat

You can't upload files whose individual size is larger than 50 MB. You can upload as many files as needed with smaller individual size. For larger files, https://git-lfs.github.com/ is recommended