设置记住密码(默认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. Oracle练习详解

    --1.查询emp表,显示薪水大于2000,且工作类别是MANAGER的雇员信息 select * from emp where sal > 2000and job = 'MANAGER'; - ...

  2. Graph 133. Clone Graph in three ways(bfs, dfs, bfs(recursive))

    Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. OJ's ...

  3. 百度地图Label 样式 setStyle

    最近一直在整百度地图,发现一个小问题: 创建文本标注对象设置样式的时候,其中的backgroundColor属性居然还支持透明啊,不过改变数值好像对效果没有影响 var numLabel = new ...

  4. 洛谷 P4593 【[TJOI2018]教科书般的亵渎】

    题目分析 一眼看上去就像是一个模拟题目,但是\(n\)的范围过大. 冷静分析一下发现难点在于如何快速求出幂和. 考虑使用伯努利数. \(B_0=1\) \(B_n=-\frac{1}{n+1}\sum ...

  5. chromedriver链接

    http://npm.taobao.org/mirrors/chromedriver/

  6. BZOJ3940:[USACO]Censoring(AC自动机,栈)

    Description Farmer John has purchased a subscription to Good Hooveskeeping magazine for his cows, so ...

  7. css圆角和阴影兼容问题(ie7,ie8)

    <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Conten ...

  8. ARM Linux 内核 panic 之cache 一致性 ——Cortex-A9多核cache和TLB一致性广播

    ARM Linux 内核 panic 之cache 一致性 ——Cortex-A9多核cache和TLB一致性广播 Cortex-A9的多喝CPU可以接收和执行一致性广播操作,当其使能并处于SMP模式 ...

  9. 类似QQ的聊天工程

    首先建立一个html:<!DOCTYPE html><html lang="en"><head> <meta charset=" ...

  10. Oracle 体系结构四 逻辑和物理存储结构之间的关系

    Oracle数据库从物理存储中完全抽象出逻辑存储.逻辑数据存储采用“段”的形式.段的类型有很多种:典型的段是“表”.这些段以物理形式存储在数据文件中.通过表空间将逻辑存储从物理存储中抽象出来.逻辑结构 ...