Jermineの博客

Jermineの博客

书不记,熟读可记;义不精,细思可精;惟有志不立,直是无着力处。

  • 首页
  • Github
  • Go语言标准库
  • Nyx
  • 关于我

git通过https协议使用仓库时如何记住token?

git通过https协议使用仓库时如何记住token?

通过配置 Git 的凭据助手(credential helper),可以记住 HTTPS 访问时需要的用户名和 Token(作为密码),避免重复输入。

常用方法(按安全性/便捷性排序)

1. 临时缓存(适合短期使用)

1git config --global credential.helper cache
2# 默认缓存 15 分钟,可修改超时(秒):
3git config --global credential.helper 'cache --timeout=3600'

2. 永久存储到文件(明文,安全性低)

1git config --global credential.helper store
2# 凭据会保存在 ~/.git-credentials,首次输入后永久生效

3. 使用操作系统安全存储(推荐)

  • Windows(Git for Windows 自带)
    1git config --global credential.helper manager-core
    2# 或旧版:git config --global credential.helper wincred
    
  • macOS(钥匙串)
    1git config --global credential.helper osxkeychain
    
  • Linux(需要安装 libsecret)
    1sudo apt-get install libsecret-1-0 libsecret-1-dev
    2sudo make -C /usr/share/doc/git/contrib/credential/libsecret
    3git config --global credential.helper /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret
    
    或者使用 gnome-keyring 等。

4. 直接在远程 URL 中嵌入 Token(一次性配置,URL 变更)

1git remote set-url origin https://你的用户名:你的token@github.com/用户名/仓库.git

⚠️ Token 会明文存储在 .git/config 中,且 git remote -v 会暴露 Token。

2021年02月18日

处理git无法显示中文的问题

git pull 遇到乱码

执行git pull 输出好多编码非中文的字符:

 1remote: Enumerating objects: 42, done.
 2remote: Counting objects: 100% (42/42), done.
 3remote: Compressing objects: 100% (18/18), done.
 4remote: Total 32 (delta 9), reused 32 (delta 9), pack-reused 0 (from 0)
 5Unpacking objects: 100% (32/32), 4.17 KiB | 8.00 KiB/s, done.
 6From github.com:JermineHu/jerminehu.github.io
 7   08d9ec6..9c5c1ec  master     -> origin/master
 8Updating 08d9ec6..9c5c1ec
 9Fast-forward
10 .../29\346\227\245/\345\205\263\344\272\216claude code\344\275\277\347\224\250.md" | 39 +++++++++++++++++++++++++++++++++++++++
11 .../30\346\227\245/\346\210\220\344\270\272\350\207\252\345\267\261.md"            |  1 +
12 .../03\346\227\245/\345\205\263\344\272\216\347\235\241\347\234\240.md"            | 21 +++++++++++++++++++++
13 ...203\345\271\263\350\203\275\346\204\210\344\270\211\345\215\203\347\226\276.md" | 15 +++++++++++++++
14 ...214\345\222\214\346\203\263\346\210\220\344\270\272\347\232\204\344\272\272.md" | 14 ++++++++++++++
15 .../05\346\227\245/\346\234\235\350\212\261\345\244\225\346\213\276.md"            |  6 ++++++
16 6 files changed, 96 insertions(+)
17 create mode 100644 "6. \350\241\250\350\276\276/\345\215\241\347\211\207/2026\345\271\264/2\345\255\243\345\272\246/05\346\234\210/03\346\227\245/\345\205\263\344\272\216\347\235\241\347\234\240.md"
18 create mode 100644 "6. \350\241\250\350\276\276/\345\215\241\347\211\207/2026\345\271\264/2\345\255\243\345\272\246/05\346\234\210/05\346\227\245/\345\277\203\345\271\263\350\203\275\346\204\210\344\270\211\345\215\203\347\226\276.md"
19 create mode 100644 "6. \350\241\250\350\276\276/\345\215\241\347\211\207/2026\345\271\264/2\345\255\243\345\272\246/05\346\234\210/05\346\227\245/\346\210\221\344\273\254\347\273\210\345\205\266\344\270\200\347\224\237\345\257\273\346\211\276\347\232\204\357\274\214\345\272\224\350\257\245\346\230\257\350\207\252\345\267\261\345\226\234\346\254\242\347\232\204\347\224\237\346\264\273\346\226\271\345\274\217\357\274\214\345\222\214\346\203\263\346\210\220\344\270\272\347\232\204\344\272\272.md"
20 create mode 100644 "6. \350\241\250\350\276\276/\345\215\241\347\211\207/2026\345\271\264/2\345\255\243\345\272\246/05\346\234\210/05\346\227\245/\346\234\235\350\212\261\345\244\225\346\213\276.md"

解决方案:

遇到的问题是 Git 默认将非 ASCII 路径名(如中文)转义为 \nnn 形式的八进制编码,这是为了确保在老旧或非 UTF-8 环境中输出不会乱码。解决办法很简单:关闭路径转义。

2021年01月18日

通过Git规范和脚本自动生成release Notes

通过Git规范和脚本自动生成release Notes

第一性原理告诉我们,我们不但要用工具,还要能自己创造工具,这样才能提升生产力! 创造的工具可以开源,让社区强大和优秀的人一起完善,很多牛X的工具就是这么来的,好的工具总得有人先把概念和第一行代码写出来牵个头,linux 、docker 、Kubernetes、tensorflow 、Git 等等 都是从概念和第一个demo 开始的,然后在社区引起共鸣才发展起来的!从问题本身出发,抛开常理逻辑,不落入俗套(套路),就是第一性原理要表达的意思,其实创新也是这样来的,Elon Mask 那种从0 到 1 的创造力就是来源于第一性原理。

2018年06月30日

Git设置和取消代理

git 设置和取消代理

本地开启VPN后,GIt也需要设置代理,才能正常略过GFW,访问goole code等网站

代理设置如下(可复制):

注:git 设置 socks5 代理 加速。只对http,https生效,对ssh仍然无效

2017年03月30日

Git clone直接提交用户名和密码

git使用用户名密码clone的方式:

git clone http://username:password@remote

例如:我的用户名是abc@qq.com,密码是abc123456,git地址为git@xxx.com/www.git

git clone http://abc@qq.com:abc123456@git.xxx.com/www.git

执行报错:

fatal: unable to access 'http://abc@qq.com:abc123456@git.xxx.com/www.git/': 
 Couldn't resolve host 'qq.com:abc123456@git.xxx.com'

报错原因是因为用户名包含了@符号,所以需求要把@转码一下

2016年08月30日

标签

  • agent2
  • ai3
  • all1
  • arm6
  • arm646
  • autossh1
  • c/c++2
  • ceph1
  • chart1
  • claude code6
  • cli1
  • code-review1
  • codex2
  • conda1
  • cross-compiling1
  • cuda4
  • cursor1
  • database1
  • debug1
  • deeplearn3
  • devops3
  • dns1
  • docker19
  • dotnet core1
  • editor1
  • efficiency4
  • gdb1
  • gemini cli1
  • git5
  • golang6
  • gpu1
  • harbor3
  • helm1
  • hud1
  • influxdb1
  • jenkins1
  • jermine1
  • jira2
  • k8s2
  • kubernates2
  • kubernetes3
  • kvm5
  • ldap2
  • linux32
  • markdown1
  • mcp1
  • microservice1
  • mirrors1
  • mq1
  • music1
  • nexcloud1
  • nvida-docker1
  • nvidia3
  • openclaw1
  • opencv2
  • openshift2
  • openstack1
  • ppt1
  • proot-distro1
  • python3
  • raspberry-pi7
  • rdp1
  • registry1
  • reviewboard1
  • samba1
  • server4
  • shortcut keys1
  • skill1
  • sse1
  • ssh1
  • ssh-tunnel1
  • swap1
  • tensorflow3
  • termux1
  • tools5
  • ubuntu1
  • vs-code2
  • web1
  • websocket1
  • windows4
  • wsl1
  • zsh1
  • 交叉编译1
  • 代理1
  • 关于我1
  • 协议2
  • 反向代理1
  • 嵌入式1
  • 开发工具2
  • 开源1
  • 敏捷开发1
  • 武汉大学授课1
  • 终端1
  • 编程工具1
  • 自动化1
  • 课程1
  • 远程桌面1
  • 项目管理1

归档

标签云

agent ai all arm arm64 autossh c/c++ ceph chart claude code cli code-review codex conda cross-compiling cuda cursor database debug deeplearn devops dns docker dotnet core editor efficiency gdb gemini cli git golang gpu harbor helm hud influxdb jenkins jermine jira k8s kubernates kubernetes kvm ldap linux markdown mcp microservice mirrors mq music nexcloud nvida-docker nvidia openclaw opencv openshift openstack ppt proot-distro python raspberry-pi rdp registry reviewboard samba server shortcut keys skill sse ssh ssh-tunnel swap tensorflow termux tools ubuntu vs-code web websocket windows wsl zsh 交叉编译 代理 关于我 协议 反向代理 嵌入式 开发工具 开源 敏捷开发 武汉大学授课 终端 编程工具 自动化 课程 远程桌面 项目管理
RSS 订阅

Powered by Jermine © 2026 Jermineの博客