目录
一、问题描述
问题1:从gitee新建项目,在本地推送代码提示没有授权,于是发现我没有配置git config的name和email,之前还是全局配置。
问题2:配置了发现每次拉取代码,都需要输入用户名和密码不太方便,所以尝试使用git remote set-url方式设置用户和密码,不过报错:
fatal: unable to access 'https://username:[email protected]: Port number ended with 'l'
二、问题解决
问题1:设置当前项目的name和email,之前我是全局的其他name,--global是全局配置,个人项目不建议使用
git config user.name=xxx
git config user.email=xxx
问题2:创建git-crenditals,设置全局配置,在项目中加入忽略
touch .git-credentials
https://username:[email protected] > .git-credentials
git config credential.helper store
git push
.git-credentials > .gitignored
三、总结
排查问题花了大部分时间,还有找资料,没有明确问题的根本。