linux git 记住密码,MAC/Linux 下 Git 记住用户名密码

Mac自带git,所以无需安装,可用以下命令查看git版本及安装位置

查看git位置

which git

whereis git

查看git版本

git --version

使用git前需先配置git

git config --global user.name "Your Name"

git config --global user.email you@example.co

1.mac/linux下

在~/下, touch创建文件 .git-credentials:

touch .git-credentials

# 用vim编辑此文件,

vim .git-credentials

#输入内容格式

https://username:password@github.com

2. 在终端下执行

git config --global credential.helper store

可以看到~/.gitconfig文件,会多了一项:

[credential]

helper = store

删除保存的密码:

1、删除保存的密码

git credential-osxkeychain erase

or:

printf "protocol=https\nhost=github.com\n" | git credential-osxkeychain erase

2、删除密码文件

rm ~/.git-credentials

备注: git更改提交用户名报错

原因有两个:

没有擦除mac自身记忆的密码串

提交对象弄错。把提交地址写错,应该是git方式,误写成htts方式了。

Git修改提交user和email方法:

使用指令修改:

git config –global user.name “name” –name是修改后的名字,去掉双引号

git config –global user.email “email” –email是修改后的邮箱地址,去掉双引号

修改配置文件。

在用户目录下:/home/username/,修改.gitconfig文件中对应的用户名和密码。

mac中擦除密钥串的方法:

使用指令:git credential-osxkeychain erase

更多:

来源:oschina

链接:https://my.oschina.net/u/2399426/blog/803036

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值