英雄联盟玩家必备的5大智能工具:如何用本地化方案提升游戏体验?
2026/7/25 14:48:38
GitLab 每次 push 都需要输入密码的问题,通常有以下几种解决方案:
这是最常用的解决方案:
# 生成 SSH 密钥(如果还没有)ssh-keygen -t ed25519 -C"your_email@example.com"# 或者使用 RSAssh-keygen -t rsa -b4096-C"your_email@example.com"cat ~/.ssh/id_ed25519.pub# 查看当前远程地址gitremote -v# 如果显示 https 地址,改为 SSH 地址gitremote set-url origin git@gitlab.com:username/project.git# 或者重新添加gitremoteaddorigin git@gitlab.com:username/project.git# 设置缓存凭证gitconfig --global credential.helper cache# 设置更长的缓存时间(单位:秒)gitconfig --global credential.helper"cache --timeout=3600"# macOSgitconfig --global credential.helper osxkeychain# Windowsgitconfig --global credential.helper wincred# Linuxgitconfig --global credential.helper store# 明文保存,注意安全如果启用了双因素认证,可以使用 Token:
api、write_repository等权限)gitclone https://oauth2:TOKEN@gitlab.com/username/project.git# 查看当前配置gitconfig --list --show-origin# 设置用户名和邮箱(重要!)gitconfig --global user.name"Your Name"gitconfig --global user.email"your_email@example.com"# 清除保存的凭证gitcredential rejectprotocol=httpshost=gitlab.com<按两次回车># 或者直接删除凭证文件# Windows: 控制面板 → 凭据管理器# macOS: 钥匙串访问# Linux: ~/.git-credentials# 在 URL 中包含用户名gitremote set-url origin https://username@gitlab.com/username/project.git# macOSgitconfig --global credential.helper osxkeychain# Windowsgitconfig --global credential.helper manager-core配置完成后,第一次操作会提示输入密码,之后就会自动记住。