简体   繁体   中英

Composer use private fork of a repository

This question is clearly answered in other places, but it simply does not work for me. I can also see a lot of people have problems with this.

I am trying to use a fork of CCXT (branch name is bitmart ) in my own project as it contains some major changes which have not yet been merged with the original ccxt/ccxt

git version: 2.20.1
composer version 1.7.2

My composer file in my project looks like this:

"repositories": [{
    "type": "vcs",
    "url": "git@github.com:devsi/ccxt"
}],
 "require": {
    "ccxt/ccxt": "dev-bitmart as 1.18.409"
}

I've tried the https url : https://github.com/devsi/ccxt and it still does not work.

I have tried removing the version constraint and instead it tries to read every single version release ever in CCXT. The processing time would take hours. It does about 1 per second.

Reading composer.json of ccxt/ccxt (1.17.378)
Reading composer.json of ccxt/ccxt (1.17.377)
Reading composer.json of ccxt/ccxt (1.17.376)

and so on.

When specifying a version, the error I receive is:

Failed to clone the git@github.com:devsi/ccxt.git repository, 
try running in interactive mode so that you can enter your GitHub credentials


  [RuntimeException]                                                                                                               
  Failed to execute git clone --mirror 'git@github.com:devsi/ccxt.git' '/root/.composer/cache/vcs/git-github.com-devsi-ccxt.git/'   

What am I doing wrong?

So for anyone else who finds this problem. My fork of the repository was up to date with the latest version of the original source. However, the tags were not. As git fetch does not fetch the tags, when synchronizing your fork and the source, make sure you also git fetch upstream --tags and git push --tags to bring the releases up to date too. Without this I was given an obscure warning about credentials and failing to execute git clone. The real error was:

[InvalidArgumentException]                                                                                                                                            
  Could not find a version of package devsi/ccxt matching your minimum-stability (dev)

This also explains why it was reading every version one by one. It could never find the version it needed as it wasn't available in the forked repo.

Once the tags were up to date. the VCS method worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM