创建存储用户名密码的文件

在home文件夹,一般是 C:\Documents and Settings\Administrator 下建立文件 .git-credentials (windows下不允许直接创建以.开头的文件,所以有一个小技巧:先创建一个文件名叫 )git-credentials 然后进入 git bash 使用命令:

mv git-credentials .git-credentials

用记事本打开这文件输入:

https://{username}:{password}@github.com

比如:

https://zhangsan:123456@github.com

保存

添加config项

在任意文件夹下右键进入 git bash

然后输入:

git config --global credential.helper store

执行完后去查看 C:\Documents and Settings\Administrator\.gitconfig 这个文件,发现多了一项:

[credential]
helper = store

就成功了。

然后要重开 git bash 窗口,再提交就不用输入用户名密码

参考资料:

git-credential-cache(1) Manual Page

NAME

git-credential-cache - helper to temporarily store passwords in memory

SYNOPSIS

git config credential.helper 'cache [options]'

DESCRIPTION

This command caches credentials in memory for use by future git programs. The stored credentials never touch the disk, and are forgotten after a configurable timeout. The cache is accessible over a Unix domain socket, restricted to the current user by filesystem permissions.

You probably don’t want to invoke this command directly; it is meant to be used as a credential helper by other parts of git. Seegitcredentials(7) or EXAMPLES below.

OPTIONS

--timeout <seconds>

Number of seconds to cache credentials (default: 900).

--socket <path>

Use <path> to contact a running cache daemon (or start a new cache daemon if one is not started). Defaults to ~/.git-credential-cache/socket. If your home directory is on a network-mounted filesystem, you may need to change this to a local filesystem.

CONTROLLING THE DAEMON

If you would like the daemon to exit early, forgetting all cached credentials before their timeout, you can issue an exit action:

git credential-cache exit

EXAMPLES

The point of this helper is to reduce the number of times you must type your username or password. For example:

$ git config credential.helper cache
$ git push http://example.com/repo.git
Username: <type your username>
Password: <type your password> [work for 5 more minutes]
$ git push http://example.com/repo.git
[your credentials are used automatically]

You can provide options via the credential.helper configuration variable (this example drops the cache time to 5 minutes):

$ git config credential.helper 'cache --timeout=300'

git for windows (又名 msysgit)如何记住用户名和密码的更多相关文章

  1. git 记住用户名和密码

    git 记住用户名和密码 在使用 git 时,如果用的是 HTTPS 的方式,则每次提交,都会让输入用户名和密码,久而久之,就会感觉非常麻烦,那么该如何解决呢? 1. 使用 SSH,添加 ssh ke ...

  2. Tortoisegit 记住用户名和密码

    Tortoisegit 记住用户名和密码方法: [Windows系统] 当你配置好git后,在 C:\Documents and Settings\Administrator\ 目录下有一个  .gi ...

  3. TortoiseGit:记住用户名和密码

    1.背景: 我们在使用 tortoisegit 工具时会无可避免的经常性 pull 和 push,这时通常要输入用户名和密码,由于麻烦,就有人提出了记住用户名和密码的需求... ... 2.设置: [ ...

  4. OpenVPN 如何记住用户名和密码

    最近在使用OpenVPN,但是没有记住用户名和密码功能,太坑人,研究一下发现是可以的. 1. 在OpenVPN安装目录下\OpenVPN\config文件夹中找到vpnserver.ovpn文件. 2 ...

  5. ASP.NET中登录时记住用户名和密码(附源码下载)--ASP.NET

    必需了解的:实例需要做的是Cookie对象的创建和对Cookie对象数据的读取,通过Response对象的Cookies属性创建Cookie,通过Request对象的Cookies可以读取Cookie ...

  6. 通过jquery.cookie.js实现记住用户名、密码登录功能

    Cookies 定义:让网站服务器把少量数据储存到客户端的硬盘或内存,从客户端的硬盘读取数据的一种技术: 下载与引入:jquery.cookie.js基于jquery:先引入jquery,再引入:jq ...

  7. jQuery cookie 实现记住用户名和密码功能

    jQuery cookie 实现记住用户名和密码功能 HTML代码 <div class="wrap"> <div class="line-top&qu ...

  8. SVN记住用户名和密码后如何修改

    今天遇到一个SVN检出代码用户验证问题.由于自己最近参与了好几个项目,一时间忙不过来.所以希望跟着自己的试用期的同事帮我测试一下刚修改完成的新功能是否有问题.但是该同事没有项目中权限,正好今天恰逢星期 ...

  9. (转)ASP.NET里面简单的记住用户名和密码

    using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Web; 5 using S ...

  10. jquery实现记住用户名和密码

    这里我们选择的方法是cookie的方式去记录 首先我们写将用户名和密码写到cookie的js代码 //保存到cookie function save_cookies(){ if($("#re ...

随机推荐

  1. Outlook Express 收发邮件出现&quot;0x800CCC0F&quot;错误代码解决方法

    非常多网友在使用Outlook Express收发邮件的过程中,有时能够发送邮件,但出现不能接收信件的问题.每次在收邮件都会在某个地方停止不动,然后报超时,出现错误代码0x800CCC19或0x800 ...

  2. SSH-Struts(一)——基本原理

    简单介绍 Struts框架是MVC的一个实现,它非常好的结合了JSP.Servlet.JavaBean.Taglib等技术.它为MVC的各层提供了良好的支持,就像房地产商盖房子时先盖的大楼框架. 仅仅 ...

  3. Spring笔记 - Bean xml装配

    命名空间表 aop Provides elements for declaring aspects and for automatically proxying @AspectJannotated c ...

  4. Python 基础编程

    Python 打印九九乘法表: for i in range(1,10): for j in range(1,i+1): print j,'*',i,'=',j*i,' ', print '\n' P ...

  5. 前端面试题整理(css)

    1.介绍所知道的CSS hack技巧(如:_, *, +, \9, !important 之类). CSS hack的原理: 由于不同的浏览器和浏览器各版本对CSS的支持及解析结果不一样,以及CSS优 ...

  6. 配置nexus仓库

    Nexus有许多默认仓库:Central,Releases,Snapshots,和3rd Party 1.配置central仓库 Nexus内置了Maven中央代理仓库Central.选择仓库列表中的 ...

  7. JS将秒换成时分秒

    function formatSeconds(value) {    var theTime = parseInt(value);// 秒    var theTime1 = 0;// 分    va ...

  8. 如何制定AxureRP设计体系

    经常有朋友问我,如何在从来没有用过AxureRP的公司或者团队里面开始使用AxureRP做原型设计?这个问题对个体来说不存在,因为个人学习使用AxureRP时非常快速的,基本试着做几个原型实例就能把整 ...

  9. Spring MVC 中采用注解方式 Action中跳转到另一个Action的写法

    Spring MVC 中采用注解方式 Action中跳转到另一个Action的写法 在Action中方法的返回值都是字符串行,一般情况是返回某个JSP,如: return "xx" ...

  10. ubuntu 安装 maven3.2

    1.下载并解压 apache-maven-3.2.5-bin.tar.gz tar -xzvf apache-maven--bin.tar.gz 2.设置环境变量 sudo gedit ~/.prof ...