设置记住密码(默认15分钟):

git config --global credential.helper cache
如果想自己设置时间,可以这样做:

git config credential.helper 'cache --timeout=3600'
这样就设置一个小时之后失效

长期存储密码:

git config --global credential.helper store
增加远程地址的时候带上密码也是可以的。(推荐)

从仓库的config的里面修改url,后面加上密码

http://yourname:password@git.oschina.net/name/project.git
补充:使用客户端也可以存储密码的。

git设置用户名密码

设置git用户名/邮箱

git config --global user.name [username]
git config --global user.email [email]

但是这个仅仅是设置用户名密码,如果你的git 源每次操作需要你输入用户名/密码验证,你依然需要每次设置,那么该如何办呢?

git保存用户名密码

这里主要是配置一个config项

有两个方法,基本上原理都是一样,都是修改.git/config文件

1.使用如下命令,修改config文件即可保存

echo "[credential]" >> .git/config
echo " helper = store" >> .git/config

2.直接修改.git/config文件

在linux/mac下可以直接使用vim工具修改config文件

ubuntu@VM-7-212-ubuntu:~/kernel-code/kernel-netfilter-sample-code$ vim .git/config

##修改成如下

[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = https://github.com/Miss-you/kernel-netfilter-sample-code.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
##主要是后面这两行,如果不想保存,则删除即可
[credential]
helper = store ##保存

这样就可以保存用户名密码,不用每次都输入了!

git config查看配置

使用git config --list查看已设配置

feiqianyousadeMacBook-Pro:xt_GTPU yousa$ git config --list
core.excludesfile=/Users/yousa/.gitignore_global
user.name=Miss-you
user.email=snowfly1993@gmail.com
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=true
remote.origin.url=https://github.com/Miss-you/xt_GTPU.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master

git配置config记住密码的更多相关文章

  1. git配置config文件

    1.Git有一个工具被称为git config,它允许你获取和设置变量:这些变量可以控制Git的外观和操作的各个方面.这些变量以等级的不同可以被存储在三个不同的位置: (1) /etc/gitconf ...

  2. Git 配置用户名、密码

    在终端输入: git config --global credential.helper store 然后git pull一次,输入一次用户名密码就会自动保存该用户名密码: 查看配置的用户信息: gi ...

  3. Git配置的用户名密码在本地的存贮位置

    全局的用户名密码配置: //配置用户名和邮箱(全局) $ git config --global user.name "j***n" $ git config --global u ...

  4. Git配置全局账号密码避免每次拉取、提交输入账号密码

    前言 在大家使用github的过程中,一定会碰到这样一种情况,就是每次要push 和pull时总是要输入github的账号和密码,这样不仅浪费了大量的时间且降低了工作效率.在此背景下,本文在网上找了两 ...

  5. 让git for windows记住密码

    store 执行这个命令git config --global credential.helper store 检查命令是否成功 $ git config -l | grep credentialcr ...

  6. Git配置用户名、邮箱、密码

    配置用户名:username git config --global user.name username 配置邮箱:user@email git config --global user.email ...

  7. git 配置 https和ssh 免密码登录 常用操作命令

    git 配置 https和ssh 免密码登录 一. 区分https clone 和 ssh clone 不同的克隆方式导致校验方式不同,对应的免秘方式也不一样. https通过记住账号密码免登,ssh ...

  8. git https连接方式,记住密码

    Git使用https方式进行连接时,默认每次推送时都要输入用户名和密码. 可以使用命令 $git config credential.helper store 为当前仓库设置记住密码,设置后,只要在推 ...

  9. 在idea中设置记住git的用户名和密码

    在idea中设置记住git的用户名和密码 1.在项目根目录下执行以下git命令: git config --global credential.helper store 2.执行上述命令后,在idea ...

随机推荐

  1. MS15-051 修正版Exploit(Webshell可用)

    MS15-051简介:Windows 内核模式驱动程序中的漏洞可能允许特权提升 (3057191) , 如果攻击者在本地登录并可以在内核模式下运行任意代码,最严重的漏洞可能允许特权提升. 攻击者可随后 ...

  2. AngularJs学习笔记--I18n/L10n

    原版地址:http://code.angularjs.org/1.0.2/docs/guide/i18n 一.I18n and L10n in AngularJS 1. 什么是I18n和L10n? 国 ...

  3. Django 模型中DateField字段

    DateField¶ class DateField([auto_now=False, auto_now_add=False, **options])¶ 这是一个使用Python的datetime.d ...

  4. 【转】 url中文乱码问题

    [转自]http://blog.csdn.net/rascalboy520/article/details/2511175 在URL中传递参数,是通过HTTP报头来传递的.并不是类似于通过表单来传递, ...

  5. luogu P4135 作诗

    嘟嘟嘟 郑重声明:我的前几到分块题写法上都有点小毛病,以这篇为主! 这道题感觉也是分块的基本套路,只不过卡常,得开氧气. 维护俩:sum[i][j]表示前 i 块中,数字 j 出现了多少次,ans[i ...

  6. 【xampp】windows下XAMPP集成环境中,MySQL数据库的使用

    在已经安装了XAMPP之后,会在你安装的目录下面出现”XAMPP“文件夹,这个文件夹就是整个XAMPP集成环境的目录. 我们先进入这个目录,然后会看到带有XAMPP标志的xampp-control.e ...

  7. java和spring 线程池总结

    1. spring 的线程池 ThreadPoolTaskExecutor @Configuration public class ThreadPoolConfig { @Bean("thr ...

  8. [转]Python中下划线以及命名空间的意义

    Python 用下划线作为变量前缀和后缀指定特殊变量/方法. 主要存在四种情形 1. 1. object # public    2. __object__ # special, python sys ...

  9. insert插入数据

    insert 语法1 --插入的值需要用单引号引起来,否则字段插入会有问题,可能造成查询的时候查询不出结果 insert  into  表名 (列名1,列名2……)  ] values  ( '值1' ...

  10. ORACLE中查询语句的执行顺及where部分条件执行顺序测试

    Oracle中的一些查询语句及其执行顺序 原文地址:https://www.cnblogs.com/likeju/p/5039115.html 查询条件: 1)LIKE:模糊查询,需要借助两个通配符, ...