2016-10-19 179 views
0

我想在我的私人GitLab存儲庫中獲取模塊的開發版本。作曲家未能克隆git回購

使用我在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 

因此,它確實似乎ch eck回購得到最新的提交(4d135f4b01dc896ffc722d8e24cc106d38cb4602) - 但它在克隆時失敗。

我可以手動克隆項目,所以它不會顯得權限:

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

我能做些什麼來解決這個問題?

+0

難道你完全composer.json文件或者你缺少什麼事情?因爲驗證它作爲json文件給我兩個錯誤。 –

+0

它現在更好嗎現在我已經完全封閉了對象? – HorusKol

+0

是的,它是在刪除第17行末尾的逗號後執行的。那麼,爲什麼它不適合你? –

回答

0

composer's documentation,所有你需要的是:

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

確保使用的實際分支的版本。

+0

我仍然得到錯誤 - 這是我最初嘗試的。在閱讀了其他人的問題後,我回到了我目前的嘗試。 – HorusKol

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

看起來像上面的例子作曲家試圖克隆一個不存在的存儲庫。

混帳克隆--no結賬--->'< ---「在/ var /籤/報告/記者/ V ...

所以在你composer.json提交您的網址,也許某處是空的。

另外,我在上面的composer.json文件中發現了至少兩個問題。

Error: Parse error on line 1: "repositories": [{ "type": "packa --------------^ Expecting 'EOF', '}', ',', ']', got ':'

Error: Parse error on line 17: ...k": "dev-develop", }} ----------------------^ Expecting 'STRING', got '}'

0

問題是由於存儲庫的排序 - 我們使用satis作爲私有包服務器。由於某些原因,satis表示dev-master分支可用,但不能正確提供(儘管它適用於標籤)。

通過這樣的混帳回購上市SATIS提前更改文件,它的工作原理:

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