Logo

dev-resources.site

for different kinds of informations.

Git Auto Push

Published at
12/22/2024
Categories
git
archlinux
scripts
Author
haxnet
Categories
3 categories in total
git
open
archlinux
open
scripts
open
Author
6 person written this
haxnet
open
Git Auto Push

I am no coder or programmer by any means. I just got my new PC and installed Vanilla Arch Linux on it and already customized it 90% to how I like my PC to be.

I use github to store working documents: I love that it has basically unlimited storage. One thing I was trying to figure out was that I am always creating new files or working on existing files.

Manually typing out all the commands in the terminal is a bit cumbersome and tiring.

I did a little research and figured out to just manually create a script that will auto push by using crontab.

First, create a script. I named it auto_push.sh

#!/bin/bash

while true; do

cd /path/to/your/directory/
git add -A # this basically add all new files and/or tracked files that has been changed
git commit -m "Auto-updates: $(date)" # this puts the timestamp
git push
sleep 30 # Pauses the script for 30 seconds before the next iteration. Adjust this number to change the frequency of checks

done
Enter fullscreen mode Exit fullscreen mode

Second, make sure you have crontab enabled in your system. If you don't have it, just download it from the AUR (I am using archlinux) you want to install cronie

you need to start the service and enable it on startup. type this in the terminal

sudo systemctl enable cronie.service
sudo systemctl start cronie.service
Enter fullscreen mode Exit fullscreen mode

now in the terminal type

crontab -e

this will open up your choice of editor, mine is vim.

in the file, put this in the line

*/5 * * * * /absolute/path/to/your/script/auto_push.sh
this code means that it will run every 5 minutes.

that's it.

archlinux Article's
30 articles in total
Favicon
GNOME vs KDE Plasma: Which One Is for You?
Favicon
DΓ­a 1/365. Instalar Rust en ArchLinux
Favicon
Git Auto Push
Favicon
Endpoint Security Bypass EXPOSED! Hackers Don't Want You to Know This!
Favicon
Creating a bootable USB flash drive in a GUI application
Favicon
Install and use VirtualBox on Arch Linux & Snigdha OS
Favicon
As a beginner I use Arch, Neovim and code in assembly btw
Favicon
Publishing My First AUR Package: CPIG
Favicon
Como habilitar el "Natural scrolling" en el touchpad en Arch Linux
Favicon
Essential Linux Text Manipulation Tools: cut, sort, uniq, tr πŸ› οΈ
Favicon
Resolving Audio Issues on Arch Linux with Hyprland: A Step-by-Step Guide
Favicon
Shell Scripting for Beginners: Automating Common Coding Tasks
Favicon
Essential Arch Linux Commands: Advanced Mastery(Part-2)[Must Read]
Favicon
Create Your Custom WSL from Any Linux Distribution (Part - 2)
Favicon
How to use Pacman on Arch Linux πŸš€
Favicon
How to Install BlackArch on Top of Arch Linux πŸ–€πŸ§
Favicon
Automate Repetitive Tasks: Creating Bash Scripts for Everyday Use πŸš€
Favicon
Bash Basics: A Beginner’s Guide to Shell Scripting
Favicon
Mastering Arch Linux: A Guide to Installation, Commands, and Mastery(Part-1)[Must Read]
Favicon
Arch Linux Pacman: A Detailed Guide with Commands and Examples 🎩🐧
Favicon
Introducing Snigdha OS: A Fresh Take on Open-Source Operating Systems
Favicon
πŸš€ Arch Linux Cheat Sheet: Essential Commands for new Users
Favicon
.py extension convention
Favicon
Repurposing Your Old Laptop: A Linux-Powered Home Server
Favicon
Step-by-Step Guide to Installing PostgreSQL on Arch Linux
Favicon
Is Linux an Operating System or a Kernel?
Favicon
Installing Arch Linux in UEFI systems(windows)
Favicon
New Rotating Shapes Animation
Favicon
What to do if you accidentally remove the `amd-ucode` package on Arch Linux
Favicon
Holy Trinity?

Featured ones: