在运行 git config --global credential.helper store
命令时,其中的 username
参数不是指你的 GitHub 用户名,而是指你本地计算机上存储 Git 凭据的用户名。
当你使用基于 token 的身份验证方式时,Git 会将访问令牌存储在本地计算机上,并将其视为凭据。通过运行 git config --global credential.helper store
命令,Git 将把这些凭据保存在本地计算机上,以便您可以在需要进行 push 或 pull 操作时快速进行身份验证。
因此,在运行该命令时,请使用您希望用于本地 Git 凭据存储的用户名。例如:
git config --global user.name "Your Name"
git config --global credential.helper store
这将设置你的本地 Git 凭据存储使用 “Your Name” 作为用户名。