Composer Satis Repository 似乎指的是 source URL 而不是 dist URL

Composer Satis Repository seems to be referring to source URL rather than dist URL

我有一个设置了基本 HTTP 身份验证的 Satis 服务器。

配置文件如下所示:

{
    "name": "MySatisServer",
    "homepage": "https:\/\/satis.example.co.uk",
    "repositories": [
        {
            "type": "git",
            "url": "git@github.com:Org\/Repo1.git"
        },
        {
            "type": "git",
            "url": "git@github.com:Org\/Repo2.git"
        },
        {
            "type": "git",
            "url": "git@github.com:Org\/Repo3.git"
        },
        {
            "type": "git",
            "url": "git@github.com:Org\/Repo4.git"
        }
    ],
    "require-all": true,
    "require-dependencies": true,
    "require-dev-dependencies": true,
    "archive": {
        "directory": "dist",
        "format": "zip",
        "prefix-url": "https://satis.example.co.uk"
    }
}

我有 运行 satis 构建,它使用看起来正确的 packages.json 文件创建了我的 dist 目录。

我可以在我的浏览器中转到 https://satis.example.co.uk 并下载我想要的任何版本的存储库作为 ZIP 并且它工作正常。

当我尝试通过 composer 使用 repo 时出现问题。

我的 composer.json 文件看起来像这样:

{
    "name": "some/project",
    "description": "",
    "license": "proprietary",
    "authors": [],
    "require": {
        "org/repo-4": "^1.0"
    },
    "repositories": [
        {
            "type": "composer",
            "url": "https://satis.example.co.uk"
        }
    ]
}

由于 Satis 服务器支持基本 HTTP 身份验证,因此我还有一个 auth.json 文件,如下所示:

{
    "http-basic": {
        "satis.example.co.uk": {
            "username": "my-username",
            "password": "my-password"
        }
    }
}

运行 a composer install 给我以下输出:

- Installing org/repo-4 (1.0.0): Downloading (failed)    Failed to download org/repo-4 from dist: The "https://api.github.com/repos/Org/Repo4/zipball/128f63b6a91cf71d5cda8f84861254452ff3a1af" file could not be downloaded (HTTP/1.1 404 Not Found)
Now trying to download from source
- Installing org/repo-4 (1.0.0): Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos
Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+box359.localdomain+2017-04-18+1416
to retrieve a token. It will be stored in "/home/ubuntu/CashbackEngine/auth.json" for future use by Composer.
Token (hidden):

从上面可以看出,它完全忽略了需要下载的文件位于https://satis.example.co.uk/dist/org/repo-4/repo-4-1.0.0-e1cd03.zip这一事实,直接跳转到尝试从[=46]的源中获取=],这不是想要的结果,因为它是私有 GitHub 存储库。

看起来它甚至没有意识到有不同的 dist 版本可用。

我的设置有问题吗?

感谢任何帮助。

问题与 composer.lock 文件有关。

尽管 Satis 上的 dist URL 是正确的,但 composer 甚至没有注意到它,因为 composer 锁定文件缓存了位于 GitHub 的旧 dist url .

解决方案是删除 composer.lock 文件和 运行 composer install。我也事先 运行 一个 composer clearcache 只是为了确定。