问题背景:
laravel项目新从git上拉取下来,初次进行composer重构,在执行composer install的时候,执行中断报如下错误:
[RuntimeException]
Failed to execute git clone --no-checkout "git@git.xxx.com:xx/api-client.git" "C:\phpStudy\PHPTuto
rial\WWW\xxx\vendor\xx\api-client" && cd /D "C:\phpStudy\PHPTutorial\WWW\xxx\vendor\xxx\a
pi-client" && git remote add composer "git@git.xxx.com:xxx/api-client.git" && git fetch composer
或者提示:
Permission denied (publickey)
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
这两个错误的原因是,都是本地git没有相应的获取服务端checkout的权限,需要在github上增加ssh key。
增加步骤如下:
ssh-keygen -t rsa -C "你的Git对应邮箱地址"
三个回车,无需修改
... Your public key has been saved in /c/Users/你的系统用户名/.ssh/id_rsa.pub
打开这个C盘的文件,复制所有内容
登陆你的GitHub或者BitBucket账号,添加上述内容为新的SSH密钥,保存即可。
添加SSH密钥的方法(@Bitbucket):


生成密钥:

这样就可以解决问题了。
在尝试使用Composer安装laravel项目时遇到Git克隆权限错误,原因是本地缺少对远程仓库的SSH访问权限。解决方法包括生成SSH密钥对,将公钥添加到GitHub或Bitbucket账户中,从而修复权限问题。

6455

被折叠的 条评论
为什么被折叠?



