git 不需要输入用户名密码配置

git 免输入用户名密码

分两种方式:通过ssh key以及git本地缓存用户名密码

ssh key

总体步骤:本地创建公钥私钥。将私钥放在~/.ssh下,公钥放到github

创建Key

$ ssh-keygen -t ed25519 -C "your_email@example.com" 或者
$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

确认ssh-agent开启

eval $(ssh-agent -s)
$ ssh-add ~/.ssh/id_ed25519 或者
$ ssh-add ~/.ssh/id_rsa

添加到github

user->setting->SSH and GPG keys
拷贝 ~/.ssh/id_ed25519.pub 或者 ~/.ssh/id_rsa.pub 内容

git 缓存用户名密码

git config  credential.helper store

~/.gitconfig 中会多出一个配置
输入密码后,git会缓存用户名密码,之后不需要再输入。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值