gpt4 book ai didi

每次我推送时,Git 都会询问用户名

转载 作者:IT老高 更新时间:2023-10-28 12:14:15 28 4
gpt4 key购买 nike

每当我尝试进入我的 repo 时,git 都会询问 username & password

我每次重新输入密码都没有问题,但问题在于输入用户名。我使用 https 来克隆我的存储库。

那么,我该如何配置 git,使其不会在每个 git push 上要求 username

我是 linux 新手,但 windows git push 中的 IIRC 只要求输入密码。

最佳答案

编辑(由@dk14 由版主和评论建议)

警告:如果您使用答案中的 credential.helper store,您的密码将完全未加密(“原样”)存储在 ~/.git-凭据。请参阅下面的评论部分或“链接”部分的答案,特别是如果您的雇主对安全问题零容忍。

即使被接受,它也不能回答实际 OP 关于仅省略用户名(而不是密码)的问题。对于有确切问题的读者@grawity 的answer可能会派上用场。


原答案(@Alexander Zhu):

您可以使用以下命令存储您的凭据

$ git config credential.helper store
$ git push http://example.com/repo.git
Username: <type your username>
Password: <type your password>

另外我建议你阅读
$ git help credentials

关于每次我推送时,Git 都会询问用户名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11403407/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com