如何使用GIT为指定项目单独设置用户名和密码。
希望项目提交起来,效果更清晰。避免全局用户名对项目提交进行污染。
使用GIT为指定项目单独设置用户名和密码
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
2条回答 默认 最新
关注 1、找到项目所在目录下的 .git,进入.git文件夹,然后执行如下命令分别设置用户名和邮箱
git config user.name "aaaaaaa" git config user.email "aaaaaaa@qq.com"
然后执行命令查看config文件:cat config
cat config
会发现里面多了刚才配置的用户名和邮箱信息user,即成功为该项目单独设置了用户名和邮箱
如果git pull 每次都要求输入用户名和密码,则可以执行如下配置... [branch "master"] remote = origin merge = refs/heads/master [user] name = aaaaaaa email = aaaaaaa@qq.com git config credential.helper store
执行后, cat config查看,则多了credential的内容:
[user] name = aaaaaaa email = aaaaaaa@qq.com [credential] helper = store
然后再回到项目目录下执行git pull/push,根据提示输入用户名和密码,输入正确后,以后再执行git pull/push 就不用输入用户名和密码了
或者在
2、.git文件夹下的config的文件,在加上用户名aaaaaaa
url = https://aaaaaaa@github.com/IBAX-io/ibax.io.git@github.com/IBAX-io/ibax.io.git
[core] repositoryformatversion = 0 filemode = false bare = false logallrefupdates = true symlinks = false ignorecase = true [remote "origin"] url = https://aaaaaaa@github.com/aaa-io/aaa.io.git fetch = +refs/heads/*:refs/remotes/origin/*
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 1无用
悬赏问题
- ¥20 机器学习能否像多层线性模型一样处理嵌套数据
- ¥20 西门子S7-Graph,S7-300,梯形图
- ¥50 用易语言http 访问不了网页
- ¥50 safari浏览器fetch提交数据后数据丢失问题
- ¥15 matlab不知道怎么改,求解答!!
- ¥15 永磁直线电机的电流环pi调不出来
- ¥15 用stata实现聚类的代码
- ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
- ¥20 docker里部署springboot项目,访问不到扬声器
- ¥15 netty整合springboot之后自动重连失效