git设置用户名密码
2016-03-31 20:18
477 查看
git设置用户名密码
设置git用户名/邮箱
git config --global user.name [username] git config --global user.email [email]
但是这个仅仅是设置用户名密码,如果你的git 源每次操作需要你输入用户名/密码验证,你依然需要每次设置,那么该如何办呢?
git保存用户名密码
这里主要是配置一个config项有两个方法,基本上原理都是一样,都是修改
.git/config文件
1.使用如下命令,修改config文件即可保存
echo "[credential]" >> .git/config echo " helper = store" >> .git/config
2.直接修改.git/config文件
在linux/mac下可以直接使用vim工具修改config文件
ubuntu@VM-7-212-ubuntu:~/kernel-code/kernel-netfilter-sample-code$ vim .git/config ##修改成如下 [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] url = https://github.com/Miss-you/kernel-netfilter-sample-code.git fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"] remote = origin merge = refs/heads/master ##主要是后面这两行,如果不想保存,则删除即可 [credential] helper = store ##保存
这样就可以保存用户名密码,不用每次都输入了!
git config查看配置
使用git config --list查看已设配置
feiqianyousadeMacBook-Pro:xt_GTPU yousa$ git config --list core.excludesfile=/Users/yousa/.gitignore_global user.name=Miss-you user.email=snowfly1993@gmail.com core.repositoryformatversion=0 core.filemode=true core.bare=false core.logallrefupdates=true core.ignorecase=true core.precomposeunicode=true remote.origin.url=https://github.com/Miss-you/xt_GTPU.git remote.origin.fetch=+refs/heads/*:refs/remotes/origin/* branch.master.remote=origin branch.master.merge=refs/heads/master
相关文章推荐
- 用递归算法实现斐波那契数列显示(Java)
- 信管师培训之第七节课作业(项目沟通管理+项目合同管理)
- Burp suite与fuzzdb
- Apache Tomcat Web集群
- Linux下mongodb的安装
- Java中的文件操作和对象的序列化
- 基于java的后台截图功能的实现
- Web开发三层架构
- Qt之一张图片自动填充背景
- HashMap类用法
- LocalCache本地缓存分享
- LocalCache本地缓存分享
- App测试中ios和Android的区别
- 公职老师像网红一样赚“外快”合法吗?
- 基本的阈值操作
- mysqlbinlog
- 报错You need to use a Theme.AppCompat theme的两种解决办法
- 我(sdut2868)
- Spring 如何注入值到静态变量
- cojs.tk(所有题目来源) 树状数组专练