简体   繁体   English

如何通过Powershell添加Windows凭证?

[英]How to add Windows Credentials via Powershell?

I am trying to add Windows Credentials for my Github account via powershell.我正在尝试通过 powershell 为我的 Github 帐户添加 Windows 凭据。

I type in the below command into powershell:我在 powershell 中输入以下命令:

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

It returns error CMDKEY: The parameter is incorrect.它返回错误CMDKEY: The parameter is incorrect.

How can I fix this?我怎样才能解决这个问题?

Note that the above parameter values work when I add credentials via gui with Control Panel -> Credential Manager -> Add a Generic Credential.请注意,当我使用控制面板 -> 凭据管理器 -> 添加通用凭据通过 gui 添加凭据时,上述参数值有效。

From the output of cmdkey /?从 output 的cmdkey /? : :

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

If I take a look at the generic github credentials in my vault, their target name is listed as:如果我查看我的保管库中的通用 github 凭据,它们的目标名称列为:

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

So, I'd suggest trying the following:所以,我建议尝试以下操作:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用PowerShell在Windows机器上检查git凭据以进行远程操作? - How to check git credentials for remote on a Windows machine with PowerShell? 如何在 Jenkins 上添加 dockerhub 凭证? - How to add dockerhub credentials on Jenkins? 如何在 git 中为分支添加凭据 - how to add credentials for a branch in git 如何避免凭据通过开发人员推送到 bitbucket? - How to avoid credentials push to bitbucket via the developers? 如何使用 GitPython 跳过 Windows 凭据管理器 - How to skip Windows Credentials Manager using GitPython 如何在 WIndows 上仔细检查我的 SSH 凭据? - How to doublecheck my SSH credentials on WIndows? 如何在不删除管理 windows 凭据管理器中的凭据的情况下使用 git 切换 github 帐户? - How to switch github account using git without deleting credentials in manage windows credentials manager? 如何在没有 Windows 凭据管理器的情况下更改我的 git 帐户凭据 - How do I change my git account credentials without Windows Credentials Manager 如何在Windows上存储Git的身份验证凭据? - How do I stored the authentication credentials for Git on Windows? 如何在 Windows 的 Git Credential Manager 中的每个 repo 本地存储凭据? - How to store credentials locally per repo in Git Credential Manager for Windows?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM