Skip to content

Instantly share code, notes, and snippets.

@Jiab77
Last active August 12, 2021 23:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jiab77/93c234925c5508ac8abccfee2f65a904 to your computer and use it in GitHub Desktop.
Save Jiab77/93c234925c5508ac8abccfee2f65a904 to your computer and use it in GitHub Desktop.
Lazy git intialisation 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