#!/bin/bash clear # Re-initialise and Push everything to Gitea... echo -e '\e[1;33mRe-initialise and Push everything to Gitea...\e[0m'; echo ''; function initGit { local -n arr=$1 for i in "${arr[@]}" do # Initialise the local git repo... echo -e '\e[1;36mInitialise the local' $i 'git repo...\e[0m'; # Remove the old repo... echo -e '\e[32mRemove the old' $i 'repo...\e[0m'; cd /foo/$i/; sudo rm -R .git; # Create the new local repo... echo -e '\e[32mCreate the new' $i 'local repo...\e[0m'; git init; # Update the local config file... echo -e '\e[32mUpdate the local' $i 'config file...\e[0m'; echo '[remote "origin"]' >> .git/config; echo ' url = git_gitea:Boffin/'$i'.git' >> .git/config; # Push the local files to the remote repo with an initial commit... echo -e '\e[32mPush the local' $i 'files to the remote repo with an initial commit...\e[0m'; git add .; git commit -m "Initial Commit"; git push -f origin main; # Done echo -e '\e[1;36m'$i 'done\e[0m'; echo ''; done } # Define the array of all the directory names array=( "Arduino" "Calckey" ) # Loop initGit array # Everything done echo -e '\e[1;33mEverything done\e[0m';