1 Setting up git

1.1 Download git

Notes for Windows users. The above download will install Git and Git Bash. Git Bash gives you a linux-like terminal that runs Bash. Git can also be run from Power Shell, but Git Bash would allow you to run every command in this tutorial (e.g., functions such as touch or echo for making file and printing lines in a terminal).

1.2 Configuring git

This user name and email is your identity when using git. Sometimes you don’t want to use a personal email, a no-reply email associated with Github is available for that. For now, just use your personal email.

1.2.1 Setup username and email

git config --global user.name "Shady Whale"

git config --global user.email "shadywhale@allthewhales.com"

1.2.2 Setup the correct linebreaks encoding

Different operating systems (OS) uses different characters to encode new lines (linebreaks). Setting git to make sure it reads the correct type of characters as linebreaks.

Mac/Linux

git config --global core.autocrlf input

Windows

git config --global core.autocrlf true

1.2.3 Setup “nano” as the text editor to interface with git

The default text editor for git is Vim, which is difficult to use. nano is a good alternative that can still handle text editing within the terminal. (You could setup other text editors as your default).

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

1.2.4 Check to ensure settings are correct

git config --list
## credential.helper=osxkeychain
## filter.lfs.clean=git-lfs clean -- %f
## filter.lfs.smudge=git-lfs smudge -- %f
## filter.lfs.process=git-lfs filter-process
## filter.lfs.required=true
## filter.lfs.required=true
## filter.lfs.clean=git-lfs clean -- %f
## filter.lfs.smudge=git-lfs smudge -- %f
## filter.lfs.process=git-lfs filter-process
## advice.pushupdaterejected=false
## advice.pushnonffcurrent=false
## advice.pushnonffmatching=false
## advice.pushalreadyexists=false
## advice.pushfetchfirst=false
## advice.pushneedsforce=false
## advice.statushints=false
## advice.statusuoption=false
## advice.commitbeforemerge=false
## advice.resolveconflict=false
## advice.implicitidentity=false
## advice.detachedhead=false
## advice.amworkdir=false
## advice.rmhints=false
## user.name=Shady Whale
## user.email=shadywhale@allthewhales.com
## core.editor=nano -w
## core.repositoryformatversion=0
## core.filemode=true
## core.bare=false
## core.logallrefupdates=true
## core.ignorecase=true
## core.precomposeunicode=true
## remote.origin.url=https://github.com/mychan24/git_github_bookdown
## remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
## gc.auto=0
## http.https://github.com/.extraheader=AUTHORIZATION: basic eC1hY2Nlc3MtdG9rZW46Z2hzX2Zwa1lpY2Y5Z0lTV0QyaDB4ck9aak1qN01jZWREbzNZMVdrYQ==
## branch.master.remote=origin
## branch.master.merge=refs/heads/master