Composer无法克隆git repo

时间:2016-10-19 01:54:10

标签: git composer-php

我正在尝试在我的私有GitLab存储库中获取模块的开发版本。

使用我在other answers中找到的内容,我的项目的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

所以,它确实似乎检查了回购以获得最新的提交(4d135f4b01dc896ffc722d8e24cc106d38cb4602) - 但它在克隆时失败。

我可以手动克隆项目,因此它似乎不是权限:

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

我该怎么做才能解决这个问题?

4 个答案:

答案 0 :(得分:0)

根据composer's documentation,您只需要:

{
    "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"
        }
     ]
}

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

答案 1 :(得分:0)

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

似乎在上面的示例中,Composer正在尝试克隆不存在的存储库。

git clone --no-checkout ---> ''< ---'/ var / checkouts / reports / reporter / v ...

所以也许你的composer.json文件中的某个地方你的网址是空的。

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

  

错误:第1行的解析错误:“存储库”:[{“type”:“packa   -------------- ^期待'EOF','}',',',']',得到':'

     

错误:第17行上的解析错误:... k“:”dev-develop“,}}   ---------------------- ^期待'STRING',得到'}'

答案 2 :(得分:0)

问题是由于存储库的排序 - 我们正在使用令人满意的私有包服务器。出于某种原因,满意地说dev-master分支是可用的,但是不能正确地提供它(它适用于标签)。

通过更改文件以便在令人满意的情况下列出git repo,它可以正常工作:

{
    "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"
    }
}

答案 3 :(得分:0)

在我的情况下,这是因为我丢失了git的$dirpath= $PSScriptRoot foreach ($item in $dirpath){ $var = Get-ChildItem $item Get-Acl $var } 凭据,因为它们是私有的,因此能够获取存储库。

喜欢:

auth.json