前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >linux服务器git pull/push时免设置提示输入账号密码方法

linux服务器git pull/push时免设置提示输入账号密码方法

原创
作者头像
用户4988085
修改2021-07-20 10:28:09
4.2K0
修改2021-07-20 10:28:09
举报
文章被收录于专栏:建站知识建站知识

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

代码语言:javascript
复制
[root@iZ25mi9h7ayZ ~]# git config --global credential.helper store

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

代码语言:javascript
复制
[user]
        name = 天明
        email = xxxx@xxxx.com
[credential]
        helper = store

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

代码语言:javascript
复制
[root@iZ25mi9h7ayZ test]# git pull
Username for 'https://git.oschina.net': xxxx@xxxx.com
Password for 'https://xxxx@xxxx.com@git.oschina.net':
代码语言:javascript
复制
[root@iZ25mi9h7ayZ ~]# cat .git-credentials
https://Username:Password@git.oschina.net

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

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档