git杂记:如何避免每次输入密码

来源:互联网 发布:淘宝怎么找卖家电话 编辑:程序博客网 时间:2024/05/05 20:56

windows:

1、在windows中添加一个HOME环境变量,变量名:HOME,变量值:%USERPROFILE%


2、进入%HOME%目录,新建一个名为"_netrc"的文件,文件中内容格式如下:

machine {git account name}.github.comlogin your-usernmaepassword your-password

重新打开git bash即可,无需再输入用户名和密码。


linux:

1、cd到git仓库目录

2、打开git配置文件:vim .git/config

3、在.git/config中添加以下配置项:

[credential]        helper = store --file /home/nginx/.git-credentials        helper = cache --timeout 30000

4、编辑/home/nginx/.git-credentials文件为以下内容:

https://your-usernmae:your-password@{git account name}.github.com

0 1
原创粉丝点击