#!/bin/bash # Create README.md with the current directory information pwd > README.md # Initialize a new Git repository (or reinitialize if it already exists) git init # Hardcode Git user information git config --global user.email "redacted@redacted" git config --global user.name "@redacted" # Add a list of files to README.md ls >> README.md # Add files to the staging area git add README.md git add *.pl *.sh *.txt *.py # Set up the remote repository URL (using SSH) if ! git remote | grep -q origin; then git remote add origin git@gitlab.com:aardvark/hja.git else echo "Remote 'origin' already exists." fi # Create a verbose, descriptive commit message based on staged changes who=$(printenv USER) now=$(date) file_list=$(git diff --cached --name-only | tr '\n' ', ' | sed 's/, $//') # Commit all staged changes git commit -m "On $now, $who added changes in files: $file_list" || { echo "Failed to commit changes"; exit 1; } # Push changes to the main branch git branch -M main git push -u origin main echo "Script completed successfully."