Skip to content

Instantly share code, notes, and snippets.

@Jiab77
Last active June 27, 2024 21:10
Show Gist options
  • Save Jiab77/93c234925c5508ac8abccfee2f65a904 to your computer and use it in GitHub Desktop.
Save Jiab77/93c234925c5508ac8abccfee2f65a904 to your computer and use it in GitHub Desktop.
Just run these commands by copy/paste or saving in a script.

Lazy git intialisation script

Just run these commands by copy/paste or saving in a script.

#!/bin/bash

# Git initialisation script
# Just because I'm a lazy guy that dont want to do it 
# manually on every installs...

# Minor arguments check
if [[ $# -eq 2 ]]; then
	# General settings
	git config --global user.name $1
	git config --global user.email $2
	git config --global push.default simple

	# Working with submodules
	git config --global push.recurseSubmodules on-demand

	# Enable credential cache for maximum lazyness
	git config --global credential.helper cache

	# Confirmation
	echo -e "\nInit done !\n"
	git config --global --list
	echo -e "\nEnjoy.\n"
else
	# Usage
	echo -e "\nUsage: $0 \"user name\" \"email address\"\n"
fi

That's all 😁

Then set it executable as follow:

chmod -v +x git-init.sh

You can name it without the .sh extension, there is no issues at all under linux.

The required parser is defined by the first line !#/bin/bash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment