# Git Notes ## Settings ``` git config --global user.name "Md. Alim Ul Karim" git config --global user.email Your email no quotes git config --global core.ignorecase false ``` ## Git Local Cred ``` git config user.name "Your Name" git config user.email "Your Email git config --list --show-origin git config user.name git config --list ``` ## Git Editor ``` git config --global core.editor "vim" git config --global core.editor "nano -w" git config --global merge.tool kdiff3 ``` ## SSH ``` ssh-keygen -t rsa -b 4096 -C 'Your email or machine id' cat ~/.ssh/id_rsa.pub sudo vim ~/.ssh/authorized_keys touch ~/.ssh/authorized_keys sudo vim ~/.ssh/authorized_keys ``` ### Vim keys ``` gg, dG - to clear all in vim now copy the keys ``` ### Windows (on bash): `clip < ~/.ssh/id_rsa.pub` ### Mac: `pbcopy < ~/.ssh/id_rsa.pub` ### GNU/Linux (requires xclip): `sudo apt install xclip` `xclip -sel clip < ~/.ssh/id_rsa.pub` cat ~/.ssh/id_rsa.pub ## Root Git Config ``` [user] name = Md. Alim Ul Karim email = [Your email] [filter "lfs"] clean = git-lfs clean -- %f smudge = git-lfs smudge -- %f process = git-lfs filter-process required = true [url "ssh://git@gitlab.com/"] insteadOf = https://gitlab.com/ ``` ## Sample Git Root Config (%userprofile%/.gitconfig) `vim ~/.gitconfig` ``` [url "ssh://git@gitlab.com/"] insteadOf = https://gitlab.com/ [filter "lfs"] clean = git-lfs clean -- %f smudge = git-lfs smudge -- %f process = git-lfs filter-process required = true [user] email = [your email] name = Md. Alim Ul Karim [alias] co = checkout br = branch ci = commit st = status ``` ## Clean Ignore Case ``` git rm -r --cached . git add --all . git commit -a -m "Versioning untracked files" git push origin master ``` ## Git line fix ``` git ls-files --eol ``` ## Git Ignore ``` # IDE .idea .idea/*.* .idea/**/*.* **/.idea/*.* **/.idea/**/*.* **/**/.idea/*.* **/**/.idea/**/*.* .idea/*.* .idea/**/*.* bin bin/*.* bin/**/*.* ``` ## Git Attrs ``` *.sh text eol=lf *.go text eol=lf *.md text eol=lf *.gitignore text eol=lf *.gitattributes text eol=lf *.ts text eol=lf *.js text eol=lf protos/* linguist-generated **/api-extractor.json linguist-language=JSON-with-Comments makefile text eol=lf ``` ## Git Alias ``` git config --global alias.co checkout git config --global alias.br branch git config --global alias.ci commit git config --global alias.st status ``` ## Git empty commit ``` git commit --allow-empty -m "Trigger Build" ``` ## References * [git config | Atlassian Git Tutorial](https://www.atlassian.com/git/tutorials/setting-up-a-repository/git-config) * [Git Alias | Atlassian Git Tutorial](https://www.atlassian.com/git/tutorials/git-alias) * [Golang GitCommon](https://gitlab.com/alim-content/git-common/-/tree/go-common)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up