Skip to content

Latest commit

 

History

History
68 lines (53 loc) · 1.3 KB

setup-git-on-linux.md

File metadata and controls

68 lines (53 loc) · 1.3 KB

How to setup Git

Optional

Getting your existing configuration from another machine

git config --list

Setting up Git

User Input

read -p 'Your Name (As you want it shown in the commit log): ' yourName

Email Input

read -p 'Email Address (123456789+USERNAME@users.noreply.github.com): ' userEmail

Install Git

if ! [ -x "$(command -v git)" ]; then     sudo apt install git -y; fi

Setup Identity

git config --global user.name "$yourName"
git config --global user.email "$userEmail"

Use nano editor

git config --global core.editor "nano -w"

Only push current branch

git config --global push.default simple

Generate a new key pair

ssh-keygen -t rsa -b 4096 -C "$(git config --global --get user.email)" -P "" -f ~/.ssh/id_rsa

Start ssh in the background

eval $(ssh-agent -s)

Add new key to local ssh

ssh-add ~/.ssh/id_rsa

Show the pub key

cat ~/.ssh/id_rsa.pub

Copy and paste the key into Github

See adding a new SSH key to your GitHub account