如何通过Powershell添加Windows凭据?



我正在尝试通过powershell为我的Github帐户添加Windows凭据。

我在powershell中输入以下命令:

cmdkey /add:"git:https://github.com" /user:"myusername" /pass:"myauthtoken"

返回错误CMDKEY: The parameter is incorrect.

我该如何解决这个问题?

注意,当我使用控制面板->凭证管理器->添加通用凭据。

cmdkey /?的输出:

To create generic credentials:
The /add switch may be replaced by /generic to create generic credentials

如果我查看我的保险库中的通用github凭据,它们的目标名称列出为:

Target: LegacyGeneric:target=git:https://github.com

所以,我建议尝试以下方法:

cmdkey /generic:LegacyGeneric:target=git:https://github.com /user:"myusername" /pass:"myauthtoken"

最新更新