You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

向Laravel仓库推送代码时遭遇Permission Denied错误求助

推送Laravel仓库代码时权限被拒的问题排查

我正尝试为Laravel贡献代码,编写完代码并创建新分支后,使用Git推送时出现权限被拒错误。通过SSH克隆的仓库,原本能正常拉取推送,也尝试更新了Git凭据,但问题依旧。控制台详细日志如下:

15:26:48.303: [framework] git -c core.quotepath=false -c log.showSignature=false checkout -b feat/add-first-or-fail-to-query-builder HEAD --
Switched to a new branch 'feat/add-first-or-fail-to-query-builder'
M   src/Illuminate/Database/Query/Builder.php
15:28:35.310: [framework] git -c core.quotepath=false -c log.showSignature=false add --ignore-errors -A -f -- src/Illuminate/Database/Query/Builder.php
warning: LF will be replaced by CRLF in src/Illuminate/Database/Query/Builder.php.
The file will have its original line endings in your working directory
15:28:35.472: [framework] git -c core.quotepath=false -c log.showSignature=false commit -F C:\Users\farsh\AppData\Local\Temp\git-commit-msg-.txt --
[feat/add-first-or-fail-to-query-builder 18d0b9917a] add the firstOrFail function to the query builder
 1 file changed, 17 insertions(+)
15:28:42.758: [framework] git -c core.quotepath=false -c log.showSignature=false push --progress --porcelain origin refs/heads/feat/add-first-or-fail-to-query-builder:refs/heads/feat/add-first-or-fail-to-query-builder --set-upstream
ERROR: Permission to laravel/framework.git denied to farshadff.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

可能的原因及解决方法:

  • 无官方仓库直接推送权限:Laravel官方仓库仅维护者具备直接推送权限,普通贡献者需先fork仓库到自己的GitHub账号,推送到自己的fork仓库后再提交Pull Request。当前你尝试推送到官方仓库,必然会被拒绝。
  • 远程仓库地址配置错误:执行git remote -v查看当前远程仓库地址,若origin指向官方仓库(git@github.com:laravel/framework.git),需修改为自己fork的SSH地址:
    git remote set-url origin git@github.com:你的GitHub用户名/framework.git
    
  • SSH密钥关联异常:用ssh -T git@github.com测试SSH连接,确认返回的用户名是否为你的GitHub账号。若不是,说明当前使用的SSH密钥未关联到你的账号,需切换正确的密钥或重新配置密钥关联。
  • 分支保护限制:若推送的是自己fork的仓库,可检查仓库的分支保护设置,确认当前分支是否允许推送。

内容的提问来源于stack exchange,提问作者Farshad

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.18 00:31:17