Composer未能克隆git repo



我正试图在我的私人GitLab存储库中获得一个模块的开发版本。

使用我在其他答案中发现的内容,我的项目的composer.json是:

{
    "repositories": [
        {
            "type": "composer",
            "url": "https://git.amh.net.au"
        },
        {
            "type": "package",
            "package": {
                "name": "amh-framework/amh-framework",
                "version": "dev-develop",
                "type": "package",
                "source": {
                    "url": "git.amh.net.au:/var/opt/gitlab/git-data/repositories/amh-framework/amh-framework.git",
                    "type": "git",
                    "reference": "master"
                }
            }
        }
    ],
    "require": {
        "amh-framework/amh-framework": "dev-develop",
    }
}

但当我运行composer update时,它会抛出RuntimeException:

Failed to execute git clone --no-checkout '' '/var/checkouts/reports/reporter/vendor/amh-framework/amh-framework' && cd '/var/checkouts/reports/reporter/vendor/amh-framework/amh-framework' && git remote add composer '' && git fetch composer                                                                                                                                                                                                                                                
fatal: repository '' does not exist

composer update -vvv的输出为:

Resolving dependencies through SAT
Dependency resolution completed in 0.001 seconds
  - Installing amh-framework/amh-framework (dev-develop 4d135f4)
Executing command (CWD): git --version
    Cloning 4d135f4b01dc896ffc722d8e24cc106d38cb4602
Executing command (CWD): git clone --no-checkout '' '/var/checkouts/reports/reporter/vendor/amh-framework/amh-framework' && cd '/var/checkouts/reports/reporter/vendor/amh-framework/amh-framework' && git remote add composer '' && git fetch composer
Executing command (CWD): git --version
Failed: [RuntimeException] Failed to execute git clone --no-checkout '' '/var/checkouts/reports/reporter/vendor/amh-framework/amh-framework' && cd '/var/checkouts/reports/reporter/vendor/amh-framework/amh-framework' && git remote add composer '' && git fetch composer
fatal: repository '' does not exist

因此,它似乎确实检查了repo以获得最新的提交(4d135f4b01dc896ffc722d8e24cc106d38cb4602(,但在克隆时失败了。

我可以手动克隆项目,所以它看起来没有权限:

git clone git.amh.net.au:/var/opt/gitlab/git-data/repositories/amh-framework/amh-framework.git

我能做些什么来解决这个问题?

根据composer的文档,您只需要:

{
    "require": {
        "amh-framework/amh-framework": "dev-develop"
    },
    "repositories": [ 
        {
            "type": "vcs",
            "url": "git@git.amh.net.au:/var/opt/gitlab/git-data/repositories/amh-framework/amh-framework.git"
        }
     ]
}

请确保使用版本的实际分支。

git clone ''
fatal: repository '' does not exist

在上面的例子中,Composer似乎试图克隆一个不存在的存储库。

git克隆--不签出--->''<---'/var/checkouts/reports/reporter/v。。。

因此,在您的composer.json文件中,您的url可能是空的。

此外,我在上面的composer.json文件中发现了至少两个问题。

错误:第1行的分析错误:";存储库":包装--------------^应为"EOF"、"}"、","、"]",得到的为":">

错误:第17行出现分析错误:。。。k〃:"dev-develt",}}----------------------^应为"STRING",得到了"}">

问题是由于存储库的排序——我们使用satis作为私有包服务器。出于某种原因,satis说dev-master分支是可用的,但不会正确地提供它(不过它适用于标记(。

通过更改文件,使git repo在satis之前列出,它起作用:

{
    "repositories": [
        {
            "type": "vcs",
            "url": "git@git.amh.net.au:amh-framework/amh-test.git"
        },
        {
            "type": "composer",
            "url": "https://svn.amh.net.au:8002"
        }
    ],
    "require": {
        "amh-framework/amh-test": "dev-master"
    }
}

在我的情况下,这是因为我缺少git的auth.json凭据,因为它们是私有的。

类似:

{
  "github-oauth": {
    "github.com": "personal-access-key"
  }
}

相关内容

  • 没有找到相关文章

最新更新