GIT用户相关
全局配置配置用户名和邮箱和密码
这样配置完之后通过http下载和提交 git 的时候就不用输入密码了
而且代码记录中也会使用配置好的用户名和邮箱地址来做标记和区分
使用git config --list查看已设配置
//配置用户名和邮箱(全局)
git config --global user.name [username]
git config --global user.email [email]
git config --global user.password [password]
//用户名和密码存贮的位置是:
~/.gitconfig
//配置用户名和邮箱(在某个特定的项目中)
git config user.name "j***n"
git config user.email "z****cn"
设置完之后进入家目录下的.gitconfig中可以看到下面的user内容
[user]
name = AAA
email = AAA@163.com
[pager]
branch = false
[alias]
lm = log --no-merges --color --date=format:'%Y-%m-%d %H:%M:%S' --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Cblue %s %Cgreen(%cd) %C(bold blue)<%an>%Creset' --abbrev-commit
[core]
excludesfile = /Users/AAA/.gitignore_global
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/Sourcetree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
[commit]
template = /Users/AAA/.stCommitMsg
http下通过URL配置免密下
主要是通过下面这个URL这样配置进行免密
url = http://账户:密码@code.mycode.pro/项目名/trade.git
在项目目录下使用vim编辑./.git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
#url = git@code.mycode.pro:项目名/trade.git
url = http://AAA:密码@code.mycode.pro/项目名/trade.git
#url = git@47.74.4.127:项目名/trade.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[branch "dev"]
remote = origin
merge = refs/heads/dev
[branch "lAAA_develop"]
remote = origin
merge = refs/heads/AAA_develop