1、先cd到根目录,执行git config --global credential.helper store命令
[[email protected] ~]# git config --global credential.helper store
2、执行之后会在.gitconfig文件中多加红色字体项
[user] name = 天明 email = [email protected] [credential] helper = store
3、之后cd到项目目录,执行git pull命令,会提示输入账号密码。输完这一次以后就不再需要,并且会在根目录生成一个.git-credentials文件
[[email protected] test]# git pull Username for ‘https://git.oschina.net‘: [email protected] Password for ‘https://[email protected]@git.oschina.net‘:
[[email protected] ~]# cat .git-credentials https://Username:[email protected]
时间: 2024-11-01 16:10:48