无法从 bitbucket 上的私有 hg 存储库读取 Composer 包
Cannot read Composer package from private hg repository on bitbucket
我正在尝试使用 bitbucket 上私有 Mercurial 存储库中的 Composer 包。 Composer 说找不到包。
让我们调用包 my-user/my-private-repo
。对于它的价值,我已将我的 SSH public 密钥添加到此存储库的 bitbucket。包的 composer.json
文件如下所示:
{
"name": "my-user/my-private-repo",
"version": "0.0.1",
"description": "Some Composer Package",
"author": "me",
"license": "blah",
"require-dev": {
"phpunit/phpunit": "5.0.*"
}
}
我想在其中使用该包的项目的 composer.json
如下所示:
{
"require": {
"my-user/my-private-repo": "^0.0.1"
},
"repositories": [
{
"type":"package",
"package":{
"name":"my-user/my-private-repo",
"version": "default",
"source":{
"type": "hg",
"url": "bitbucket.org/my-user/my-private-repo",
"reference":"default"
}
}
}
]
}
当我 运行 composer update
时,出现以下错误:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package my-user/my-private-repo could not be found in any version, there may be a typo in the package name.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
我已经阅读了所有我能在 SO 上找到的似乎相关的内容,但我似乎无法克服这个错误。如何在项目中使用我的 Composer 包?
不要使用 "package" 类型。这仅对不在存储库中的软件真正有用。它旨在替代将 ZIP 下载集成到 Composer 中。
此外,收集该 "package" 类型的所有必要信息也很复杂。
存储库更简单:
"repositories": [
{
"type": "vcs",
"url": "ssh://hg@bitbucket.org/my-user/my-private-repo"
}
]
存储库必须有一个有效的 composer.json
文件——如果它也有标记的版本,它真的很有帮助,因为使用分支的依赖最终会被破坏,因为你不能发出向后不兼容的变化,也不能回到定义的状态早期版本。
composer.json
不能有版本。这就是存储库标签的用途。
注意:"type":"vcs"
通常运行良好,可以检测 Git、Hg 或 SVN 存储库。
我正在尝试使用 bitbucket 上私有 Mercurial 存储库中的 Composer 包。 Composer 说找不到包。
让我们调用包 my-user/my-private-repo
。对于它的价值,我已将我的 SSH public 密钥添加到此存储库的 bitbucket。包的 composer.json
文件如下所示:
{
"name": "my-user/my-private-repo",
"version": "0.0.1",
"description": "Some Composer Package",
"author": "me",
"license": "blah",
"require-dev": {
"phpunit/phpunit": "5.0.*"
}
}
我想在其中使用该包的项目的 composer.json
如下所示:
{
"require": {
"my-user/my-private-repo": "^0.0.1"
},
"repositories": [
{
"type":"package",
"package":{
"name":"my-user/my-private-repo",
"version": "default",
"source":{
"type": "hg",
"url": "bitbucket.org/my-user/my-private-repo",
"reference":"default"
}
}
}
]
}
当我 运行 composer update
时,出现以下错误:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package my-user/my-private-repo could not be found in any version, there may be a typo in the package name.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
我已经阅读了所有我能在 SO 上找到的似乎相关的内容,但我似乎无法克服这个错误。如何在项目中使用我的 Composer 包?
不要使用 "package" 类型。这仅对不在存储库中的软件真正有用。它旨在替代将 ZIP 下载集成到 Composer 中。
此外,收集该 "package" 类型的所有必要信息也很复杂。
存储库更简单:
"repositories": [
{
"type": "vcs",
"url": "ssh://hg@bitbucket.org/my-user/my-private-repo"
}
]
存储库必须有一个有效的 composer.json
文件——如果它也有标记的版本,它真的很有帮助,因为使用分支的依赖最终会被破坏,因为你不能发出向后不兼容的变化,也不能回到定义的状态早期版本。
composer.json
不能有版本。这就是存储库标签的用途。
注意:"type":"vcs"
通常运行良好,可以检测 Git、Hg 或 SVN 存储库。