Git Configuration¶
0. Introduction¶
In this article, we introduces git configuration for basic use.
Remarkablely, configurations for symbolic links are supported on Windows with extra settings.
The purpose we have to point out, is the git compatibility on both Windows and Unix like system.
1. Git Initialization¶
- Config User Name
- Config User Email
2. Config Git with GPG¶
-
Config signingkey
XXXXXXXXXXXXXXXX: Personal gpg private key in LONG or SHORT format
-
Config GPG
-
Config Commit and Tag
3. Config Git on Windows for compatibility with Unix like system¶
-
Config filemode authority
-
Config CRLF and LF auto change
-
Config case-sensitive
-
Config symlinks
3.1 Additional settings on Windows¶
- Enable Develop Mode on Windows10 and later
- Enable
symlinks
on installing git on Windows - Group Policy:
- Navigate to create user permission to create symbolic links:
- Computer Configuration → Windows Settings → Security Settings → Local Policies → User Rights Assignment → Create symbolic links
- type the user name and click “Check Names” then OK.
4. Config Git ignore LFS by default¶
git config --global filter.lfs.smudge "git-lfs smudge --skip -- %f"
git config --global filter.lfs.process "git-lfs filter-process --skip"
5. .gitconfig
Looks Like¶
[core]
symlinks = true
autocrlf = true
filemode = false
ignorecase = false
[user]
name = User Name
email = Username@example.com
signingkey = XXXXXXXXXXXXXXXX
[commit]
gpgsign = true
[tag]
gpgsign = true
[gpg]
program = C:\\Program Files (x86)\\GnuPG\\bin\\gpg.exe
[filter "lfs"]
smudge = git-lfs smudge --skip -- %f
process = git-lfs filter-process --skip
6. Add symbolic links on Windows¶
/d Creates a directory symbolic link. By default, this command creates a file symbolic link.
/h Creates a hard link instead of a symbolic link.
/j Creates a Directory Junction.
<link>
Specifies the name of the symbolic link being created.
<target>
Specifies the path (relative or absolute) that the new symbolic link refers to./? Displays help at the command prompt.
7. Add Tag¶
8. Delete Tag¶
9. Commit Tag¶
10. Delete Git Branch¶
REF¶
[1]. https://git-scm.com/book/en/v2/Git-Tools-Signing-Your-Work
[2]. https://github.com/git-for-windows/git/wiki/Symbolic-Links
[3]. https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/mklink