码迷,mamicode.com
首页 > 系统相关 > 详细

linux服务器git pull/push时避免频繁输入账号密码

时间:2017-08-11 10:36:15      阅读:181      评论:0      收藏:0      [点我收藏+]

标签:http   文件中   store   tco   .net   .com   nbsp   bsp   com   

1、先cd到根目录,执行git config --global credential.helper store命令

[root@iZ25mi9h7ayZ ~]# git config --global credential.helper store

2、执行之后会在.gitconfig文件中多加红色字体项

[user]
        name = wang
        email = xxxx@xxxx.com
[credential]
        helper = store

3、之后cd到项目目录,执行git pull命令,会提示输入账号密码。输完这一次以后就不再需要,并且会在根目录生成一个.git-credentials文件

[root@iZ25mi9h7ayZ test]# git pull
Username for ‘https://git.oschina.net‘: xxxx@xxxx.com
Password for ‘https://xxxx@xxxx.com@git.oschina.net‘:
[root@iZ25mi9h7ayZ ~]# cat .git-credentials
https://Username:Password@git.selfgit.net

4、之后pull/push代码都不再需要输入账号密码了~

 

 
 

linux服务器git pull/push时避免频繁输入账号密码

标签:http   文件中   store   tco   .net   .com   nbsp   bsp   com   

原文地址:http://www.cnblogs.com/wt11/p/7344252.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!