Cloning failed using an ssh key for authentication, enter your GitHub credential

190 阅读1分钟

问题描述:

通过 composer require 安装扩展时,提示错误: Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos When working with public GitHub repositories only ....

image.png

解决方案一:

1、复制提示里的链接,去生成token 2、将token更新到文件:C:/Users/jetlong/AppData/Roaming/Composer/auth.json

{
    "bitbucket-oauth": {},
    "github-oauth": {
        "github.com": "ghp_sdfsdfsdfsdfsdfsdfsfwerwewer"},
    "gitlab-oauth": {},
    "gitlab-token": {},
    "http-basic": {},
    "bearer": {}
}

解决方案二【推荐】:

直接命令行输入:

composer config --global --auth github-oauth.github.com ghp_sdfsdfsdfsdfsdfsdfsfwerwewer

至此,提示token的问题已解决了

但是,继续composer安装,又出现了新问题

image.png

解决方案:

 git config --global http.sslVerify false

再次composer安装就成功了。