Linux下 保存 git账号密码

正文开始

<p>一、通过文件方式</p><p>1.在~/下, touch创建文件 .git-credentials, 用vim编辑此文件,输入内容格式:</p><pre>touch .git-credentials vim .git-credentials</pre><p>在里面按“i”然后输入: https://{username}:{password}@github.com <br /></p><p>比如 https://account:password@github.com</p><p>2. 在终端下执行</p><pre>git config --global credential.helper store</pre><p>3. 可以看到~/.gitconfig文件,会多了一项:</p><pre>[credential] helper = store</pre><p>4.OK</p><p> </p><p>二、通过缓存方式</p><p>要求:git版本需要>=1.7.10</p><pre>git config --global credential.helper cache # 默认缓存密码15分钟,可以改得更长, 比如1小时 git config --global credential.helper 'cache --timeout=3600'</pre>

正文结束

git测试和发布流程 TortoiseGit使用sshkey,无需输入账号和密码