git for windows (又名 msysgit)如何记住用户名和密码
创建存储用户名密码的文件
在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)如何记住用户名和密码的更多相关文章
- git 记住用户名和密码
git 记住用户名和密码 在使用 git 时,如果用的是 HTTPS 的方式,则每次提交,都会让输入用户名和密码,久而久之,就会感觉非常麻烦,那么该如何解决呢? 1. 使用 SSH,添加 ssh ke ...
- Tortoisegit 记住用户名和密码
Tortoisegit 记住用户名和密码方法: [Windows系统] 当你配置好git后,在 C:\Documents and Settings\Administrator\ 目录下有一个 .gi ...
- TortoiseGit:记住用户名和密码
1.背景: 我们在使用 tortoisegit 工具时会无可避免的经常性 pull 和 push,这时通常要输入用户名和密码,由于麻烦,就有人提出了记住用户名和密码的需求... ... 2.设置: [ ...
- OpenVPN 如何记住用户名和密码
最近在使用OpenVPN,但是没有记住用户名和密码功能,太坑人,研究一下发现是可以的. 1. 在OpenVPN安装目录下\OpenVPN\config文件夹中找到vpnserver.ovpn文件. 2 ...
- ASP.NET中登录时记住用户名和密码(附源码下载)--ASP.NET
必需了解的:实例需要做的是Cookie对象的创建和对Cookie对象数据的读取,通过Response对象的Cookies属性创建Cookie,通过Request对象的Cookies可以读取Cookie ...
- 通过jquery.cookie.js实现记住用户名、密码登录功能
Cookies 定义:让网站服务器把少量数据储存到客户端的硬盘或内存,从客户端的硬盘读取数据的一种技术: 下载与引入:jquery.cookie.js基于jquery:先引入jquery,再引入:jq ...
- jQuery cookie 实现记住用户名和密码功能
jQuery cookie 实现记住用户名和密码功能 HTML代码 <div class="wrap"> <div class="line-top&qu ...
- SVN记住用户名和密码后如何修改
今天遇到一个SVN检出代码用户验证问题.由于自己最近参与了好几个项目,一时间忙不过来.所以希望跟着自己的试用期的同事帮我测试一下刚修改完成的新功能是否有问题.但是该同事没有项目中权限,正好今天恰逢星期 ...
- (转)ASP.NET里面简单的记住用户名和密码
using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Web; 5 using S ...
- jquery实现记住用户名和密码
这里我们选择的方法是cookie的方式去记录 首先我们写将用户名和密码写到cookie的js代码 //保存到cookie function save_cookies(){ if($("#re ...
随机推荐
- JAVA技术专题综述之线程篇(1)
本文详细介绍JAVA技术专题综述之线程篇 编写具有多线程能力的程序经常会用到的方法有: run(),start(),wait(),notify(),notifyAll(),sleep(),yield( ...
- 转:onConfigurationChanged的作用
API原文说明:android:configChangesLists configuration changes that the activity will handle itself. When ...
- Oracle多实例的配置方法
SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME /dbhome_2) (PROGRAM ...
- 基于visual Studio2013解决C语言竞赛题之0907删除记录
题目
- JavaScript实现获取table中某一列的值
JavaScript实现获取table中某一列的值 1.实现源代码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional/ ...
- 使用ViewPager模拟实现应用程序启动界面
经常在开发应用程序的时候,软件启动有启用动画界面,一般使用图片来进行界面该版本最新更新等等内容,今天来使用ViewPager来模拟实现这功能,也希望对大家有个小小的参考作用,在以后的项目中能够使用到. ...
- android 从其他app接收分享的内容
Receiving Content from Other Apps[从其他app接收分享的内容] 就像你的程序能够发送数据到其他程序一样,其他程序也能够简单的接收发送过来的数据.需要考虑的是用户与你的 ...
- 基于visual Studio2013解决面试题之1307二分查找
题目
- 页面提交进不了Action的原因
1.进不了action,页面没有任何js报错,可能的原因是数据类型不一致.例如用ajax方式提交所带的参数类型a是String类型,而action中定义的a是Integer类型就会导致这种情况的发生.
- Andorid时间控件和日期控件