我有一台设置了基本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"
}
}
我运行了satisf build,它创建了我的dist目录,其中packages.json
文件看起来正确。
我可以在浏览器中转到https://satis.example.co.uk
并下载我想要的任何版本的存储库作为ZIP,它可以正常工作。
当我尝试通过作曲家使用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上的源代码获取,这不是所需的结果,因为它是一个私有的GitHub存储库。
看起来它甚至没有意识到有不同的dist版本。
我的设置有问题吗?
感谢任何帮助。
答案 0 :(得分:3)
问题与composer.lock
文件有关。
尽管Satis上的dist URL是正确的,但作曲家甚至没有注意它,因为作曲家锁定文件缓存了GitHub上的旧的URL。
解决方案是删除composer.lock
文件并运行composer install
。我之前也跑了composer clearcache
只是为了确保。