php - Composer Satis Repository 似乎指的是源 URL 而不是 dist URL

标签 php github composer-php satis

我有一个设置了基本 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"
        }
    }
}

运行 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,并直接跳转到尝试从 GitHub 上的源代码获取,这不是预期的结果,因为它是私有(private) GitHub 存储库。

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

我的设置有问题吗?

感谢任何帮助。

最佳答案

问题与 composer.lock 文件有关。

虽然 Satis 上的 dist URL 是正确的,但 composer 甚至没有注意它,因为 composer 锁定文件缓存了 GitHub 上的旧 dist url。

解决方案是删除composer.lock 文件并运行composer install。我还预先运行了一个 composer clearcache 来确保这一点。

关于php - Composer Satis Repository 似乎指的是源 URL 而不是 dist URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43474848/

相关文章:

laravel - 联盟/上Laravel flysystem-AWS-S3-V3等8级封装要求较低版本

php - MySQL - 如何根据用户 ID 合并行并生成 SUM

PHP 破坏了我的日期

node.js - 在服务器上存储我自己的访问 token / secret 的正确方法

javascript - 是否可以在不下载应用程序的情况下将文件上传到 github 帐户/存储库?

php - 无法通过 ssh 访问服务器下载 Composer - 1and1

php - 以本地语言输出的日期函数

php - 优雅的换行解决方案(PHP)

github - 放弃 Github Desktop (Mac) 中的所有更改

symfony - 是否可以通过 Composer 更改 php bin/console?