设置 Git 凭据缓存(针对 HTTPS)

1. 启用凭据缓存

bash 复制代码
git config --global credential.helper cache

默认缓存时间为 15 分钟,可以设置更长时间(例如 1 小时,3600 秒):

bash 复制代码
git config --global credential.helper 'cache --timeout=3600'

2. 使用凭据存储(永久保存用户名和密码)

bash 复制代码
git config --global credential.helper store

在下一次执行 git clone 或 git pull 时,输入一次用户名和密码,Git 会将它们存储在 ~/.git-credentials 文件中,后续操作会自动使用。

相关推荐
孤廖17 分钟前
面试官问 Linux 编译调试?gcc 编译流程 + gdb 断点调试 + git 版本控制,连 Makefile 都标好了
linux·服务器·c++·人工智能·git·算法·github
emma羊羊6 小时前
【Redis】
数据库·redis·缓存
Flash Dog10 小时前
git推送远程仓库
git
shuangrenlong10 小时前
git 快速批量cp某些提交到分支一次性合入
git
aristo_boyunv11 小时前
Redis底层原理-持久化【详细易懂】
数据库·redis·缓存
xiucai_cs12 小时前
【git】rebase 和 merge 区别及使用建议
git·rebase·merge
羊锦磊12 小时前
[ Redis ] SpringBoot集成使用Redis(补充)
java·数据库·spring boot·redis·spring·缓存·json
williamdsy13 小时前
【清除 Mac DNS 缓存】Mac 电脑能访问外网却无法加载特定页面?你的 DNS 缓存“发霉”了!
macos·缓存
奎歪歪16 小时前
UniApp缓存系统详解
缓存·uni-app·1024程序员节
en-route18 小时前
使用缓存版本号解决缓存一致性问题
缓存