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

在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. 演练2-2:Guestbook示例应用程序

    为使Guestbook应用程序有用,我们需要为用户提供一些提交数据的方式,将这些数据存储起来,以便稍后进行查看.为了达到这一目标,我们打算对应用程序添加一个数据库,将其作为该留言簿的后台存储库. 1. ...

  2. Android移动view动画问题

    http://www.cnblogs.com/eoiioe/archive/2012/08/29/2662546.html Android写动画效果不是一般的麻烦,网上找了好久,终于解决了动画的问题, ...

  3. JavaScript对滚动栏的操作

    <html> <head> <meta http-equiv="Content-Type" content="text/html; char ...

  4. Swift学习之UI开发初探

    Swift是供iOS和OS X应用编程的新编程语言.相信很多开发者都在学习这门新语言.废话不多说,下面我就来学习使用Swift创建一个简单的UI应用程序. AD: 概述 Apple近日发布了Swift ...

  5. easyUI相关知识

    $("#sportGroupInfoDialog").dialog("open");//打开一个对话框,设置这个对话框的的布局方式 $('#sportGroup ...

  6. Troubleshooting:lvm调整分区时“Error parsing metadata for VG fedora”的解决

    磁盘满了,由于使用的是lvm,想要扩容时发现无论lvs还是lvdisplay这类命令都会报同样的错: [root@localhost qwang]# lvs Parse error at (line ...

  7. jquery 如何动态添加、删除class样式方法介绍

    获取与设置样式 获取class和设置class都可以使用attr()方法来完成.例如使用attr()方法来获取p元素的class 取与设置样式 获取class和设置class都可以使用attr()方法 ...

  8. 【Tesseract-OCR】在VS2012环境下调用API方法---注意避免名字冲突

    由于在VS2012中使用OpenCV可以得到插件ImageWatch.vsix的支持,查看图像非常方便,所以一直想在VS2012环境下把Tesseract-OCR融合进来,但是这一错误折腾了我好久: ...

  9. Delphi中MethodAddress汇编代码的解析

    class function TObject.MethodAddress(const Name: ShortString): Pointer;asm        { ->    EAX     ...

  10. axure网格设置

    Axure默认的界面是没有吧网格显示出来,没有网格在制作原型的时候,对齐方面不是很好,个人习惯还是把网格显示出来,便于组件对齐和布局. 其实本来这篇文章应该叫做网格与参考线,只是本人对参考线的应用还很 ...