- 方法1:在.git目录中有个config目录,在路径前配置下用户名和密码即可,如下所示:
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
[remote "origin"]
url = http://账号:'密码'@192.168.120.100:8080/xxxxxxx/DYNetwork.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
- 方法2:设置对所有项目有效(推荐使用,一行命令搞定)
打开终端并且输入:
git config --global credential.helper osxkeychain