Username for '<https://github.com>': <513190012@qq.com>
Password for '<https://513190012@qq.com@github.com>':
remote: Invalid username or token. Password authentication is not supported for Git operations.
致命错误:'<https://github.com/TonyCloouud/java-utils.git/>' 鉴权失败
步骤 1:生成 SSH 密钥
生成密钥(替换为你的 GitHub 邮箱)
ssh-keygen -t ed25519 -C "你的邮箱@xxx.com"
一路回车(默认路径、无密码),生成 \~/.ssh/id\_ed25519(私钥)和 id\_ed25519.pub(公钥)
步骤 2:添加公钥到 GitHub
复制公钥内容:
cat \~/.ssh/id\_ed25519.pub
登录 GitHub:头像 → Settings → SSH and GPG keys → New SSH key;
粘贴公钥内容,填标题(如 macbook-ssh),点击 Add SSH key。
步骤 3:修改仓库远程地址为 SSH 格式
替换 HTTPS 地址为 SSH 地址
git remote set-url origin <git@github.com>\:TonyCloouud/java-utils.git
验证 SSH 连接
ssh -T <git@github.com>
出现 "Hi TonyCloouud! You've successfully authenticated..." 表示成功