将 SSH 密钥添加到 macOS 的钥匙串中

git提交代码时,如果SSH密码并未免密,每次拉取,上传操作时都需要密码输入,

可将SSH`密钥添加到钥匙串中

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

报错:

WARNING: The -K and -A flags are deprecated and have been replaced

by the --apple-use-keychain and --apple-load-keychain

flags, respectively. To suppress this warning, set the

environment variable APPLE_SSH_ADD_BEHAVIOR as described in

the ssh-add(1) manual page.

Identity added: /Users/menmen/.ssh/id_rsa (xxx@xxx.com)

通常是在将 SSH 密钥添加到 macOS 的钥匙串中时出现的,在 macOS 上使用的,它指出 -K 和 -A 标志已经被弃用。

解决:

在添加 SSH 密钥时,使用新的标志,不会在出现弃用警告

html 复制代码
ssh-add --apple-use-keychain ~/.ssh/id_rsa

之后,在该仓库中的操作将不再需要输入用户名和密码,git 会自动使用存储的凭据

相关推荐
zhangfeng11334 小时前
com.apple.quarantine 并不是乱码,而是 macOS Gatekeeper 给下载文件自动打上的“隔离属性
macos·策略模式
BIBI20496 小时前
换 Git 托管平台怎么做?基于 TortoiseGit 的跨平台迁移教程
windows·git·tortoisegit·问题解决·版本控制·最佳实践
甘晴void8 小时前
我给 Magpie 做了个 macOS 桌宠:106 段动画,请求一多就亮灯
macos·electron·开源·deepseek·桌面宠物·magpie
donecoding9 小时前
Apple 芯片 Mac 的终端为什么还在跑 Intel?从 tmux 查起
macos
是真的小外套10 小时前
网络安全实战第7期:Hydra爆破SSH实战
安全·web安全·ssh
echome88813 小时前
Git 日常救急:撤销提交、找回误删文件和解决冲突
git·版本控制
DevLoom_14 小时前
macOS 27 升级后 Time Capsule 无法备份?AFP 协议废弃后的完整解决方案与备份迁移教程
macos·时间机器·macos27·macos 27备份·macos实用技巧
金海星科技15 小时前
船舶交通管理中心的人工智能值守:从“听、说、读、写“看人机协同
人工智能·macos·xcode
小相会自律18 小时前
全平台远程控制软件推荐2026:Win/Mac/Linux/手机/鸿蒙互通哪款好
linux·macos·智能手机·todesk·teamviewer·向日葵
赵民勇18 小时前
Git命令详解
git