Path :
Windows C:\Users\Username\.gitconfig
Unix/Linux $HOME\.gitconfig
Ubuntu /Git editor
git config --global core.editor vim
[lake@lake-aliyun-sh-china ~]$ cat .gitconfig
[gui]
encoding = utf-8
[user]
email = lake.hu@outlook.com
name = Lake Hu
[color]
ui = auto
[pack]
threads = 1
deltaChaseSize = 128m
windowMemory = 256m
#### Local Git Server instead of Google/Android official git!!!
[url "git://localhost.localdomain/aosp/"]
insteadof = https://android.googlesource.com/
[url "git://localhost.localdomain/aosp/"]
insteadof = https://gerrit.googlesource.com/
[url "git://localhost.localdomain/github/peyo-hd/"]
insteadof = https://github.com/peyo-hd/
[url "git://localhost.localdomain/ProjectName/"]
insteadof = git://codeaurora.org/quic/la/
[url "git://localhost.localdomain/ProjectName/"]
insteadof = https://source.codeaurora.org/quic/la/
[alias]
#logall = log --graph --pretty=oneline --all --abbrev-commit --decorate
logall = log --all --graph --abbrev-commit --decorate --pretty=oneline
logall2 = log --all --graph --abbrev-commit --decorate --pretty=oneline --stat -p
log2 = log --graph --abbrev-commit --decorate --pretty=format:"%Cred%h%Creset-%C(yellow)%d%Cblue%s%Cgreen(%cd)%C(red)<%an>" --date=short
[core]
autocrlf = input
editor = vim
1. alias
[alias]
#logall = log --graph --pretty=oneline --all --abbrev-commit --decorate
logall = log --all --graph --abbrev-commit --decorate --pretty=oneline
logall2 = log --all --graph --abbrev-commit --decorate --pretty=oneline --stat -p
log2 = log --graph --abbrev-commit --decorate --pretty=oneline --stat -p
git log --graph --abbrev-commit --decorate --pretty=format:"%Cred%h%Creset -%C(yellow)%d%Cblue %s %Cgreen(%cd) %C(bold blue)<%an>"
2. DOS/Unix file format
Text file
UNIX/Linux 0x0A(LF), DOS/Windows 0x0D0A(CRLF)
问题
需要把再Windows git下模式dos改为unix 。
方法命令
查看当前文本的模式类型,一般为dos,unix
:set ff
#提交时转换为LF,检出时转换为CRLF
git config --global core.autocrlf true
#提交时转换为LF(Unix/Linux text format),检出时不转换(以上问题使用此命令可解决)
git config --global core.autocrlf input
#提交检出均不转换
git config --global core.autocrlf false
#提交检出均不转换
$ git config --global core.autocrlf false
#提交时转换为LF,检出时转换为CRLF
$ git config --global core.autocrlf true
#提交时转换为LF,检出时不转换
$ git config --global core.autocrlf input
#拒绝提交包含混合换行符的文件
git config --global core.safecrlf true
#允许提交包含混合换行符的文件
git config --global core.safecrlf false
#提交包含混合换行符的文件时给出警告
git config --global core.safecrlf warn
- Checkout Windows-style, commit Unix-style (core.autocrlf = true)
- Checkout as-is, commit Unix-style (core.autocrlf = input)
- Checkout as-is, commit as-is (core.autocrlf = false)
One downside of turning off autocrlf
is that the output of git diff
highlights CR characters (indicated by ^M
) as whitespace errors. To turn off this “error”, you can use the core.whitespace
setting:
git config --global core.whitespace cr-at-eol
3. Proxy
lake@localhost:~/Google$ git config --global https.proxy "10.24.1.1:8080"
lake@localhost:~/Google$ git config --global http.proxy "10.24.1.1:8080"
............
### Cancel git/http proxy
git config --global --unset http.proxy
git config --global --unset https.proxy