先讲原因:pull Github仓库时用了HTTPS。需要是SSH。

把本地仓库远程地址改为 SSH 地址,再重新push就可以了。
来看下具体情况。
在IDEA中改好代码,push时报错了:

PyCharm cosole也有报错:
fatal: could not read Username for 'https://github.com': Device not configured
Remote "origin" does not support the Git LFS locking API. Consider disabling it with:
$ git config lfs.https://github.com/helloworldtang/GPT_teacher-3.37M-cn.git/info/lfs.locksverify false
Git credentials for https://github.com/helloworldtang/GPT_teacher-3.37M-cn.git not found:
credential fill errors:
exit status 1
error: failed to push some refs to 'https://github.com/helloworldtang/GPT_teacher-3.37M-cn.git'错哪了?没有配置用户名密码?
之前已经在Github上配置过SSH密钥了。

再来GitHub → Settings → SSH and GPG keys → New SSH key检查一下:

你说的都对,but为什么报错了?
看报错信息中是
https://github.com/helloworldtang/GPT_teacher-3.37M-cn.git配置的SSH Key,是不是不匹配?





问题解决。
习惯使用git命令行的同学,操作路径如下:
1、检查本地 SSH 密钥:
打开终端,执行:
ls -la ~/.ssh若存在 id_rsa/id_ed25519(私钥)和 id_rsa.pub/id_ed25519.pub(公钥),跳过步骤 2;否则生成密钥:
2、生成 SSH 密钥:
ssh-keygen -t ed25519 -C "your_email@example.com" # 替换为你的 GitHub 邮箱按回车默认保存路径,无需设置密码(或按需设置)。
Ed25519 是基于扭曲爱德华曲线(Twisted Edwards Curve) 的椭圆曲线加密(ECC)算法,由 Daniel J. Bernstein 等人设计,是目前最安全、高效的非对称加密 / 签名算法之一,广泛用于 SSH、TLS、密码学库(如 libsodium)、区块链等场景。 Ed25519详解
3、添加 SSH 密钥到 GitHub:
cat ~/.ssh/id_ed25519.pub # 若用 RSA 则是 cat ~/.ssh/id_rsa.pub4、修改本地仓库的远程地址为 SSH
cd /Users/username/GPT_teacher-3.37M-cn
git remote set-url origin git@github.com:helloworldtang/GPT_teacher-3.37M-cn.git5、测试 SSH 连接:
ssh -T git@github.com
若输出 Hi helloworldtang! You've successfully authenticated...,说明配置成功。
6、重新推送
git push origin feature/gpu-train-accelsuccess.
完成。
tips: GitHub 推荐使用 SSH 协议进行 Git 操作,无需每次输入密码,且稳定性更高。