こんにちは、Unityエンジニアのオオバです。
→11万文字で徹底解説した「DOTweenの教科書」Unityアニメーションの超効率化ツールはこちら
もくじ
結論
プライベートリポジトリは専用のレジストリサーバーを立てる必要がある。
Verdaccioでローカルのnpmサーバーを立ててUnityPackageManagerにプライベートリポジトリを使う
※レジストリサーバーを立ててプライベートリポジトリをUnityPackageManagerで使用する記事を書きました。
経緯
UnityのPackageManagerを使うにあたって、プライベートリポジトリが使えないっぽいので、いろいろ試して、駄目な理由を洗う記事です。
githubにテストのプライベートリポジトリを作成して検証してみます。
Page not found · GitHub · GitHub
※プライベートリポジトリなのでアクセスできません

├── LICENSE
├── README.md
└── hoge
├── aaaaa.txt
├── hoge.txt
└── package.json
ファイル構成は上記です。hogeディレクトリにpackage.jsonがあるので、パッケージURLは以下になります。
https://baobao@github.com/test-package.git?path=hoge
以下試したURLと出力されたエラー内容です。
git@始まりのURLの場合
"info.shibuya24.test":"git@github.com:baobao/test-package.git?path=hoge"
エラー内容
An error occurred while resolving packages:
Project has invalid dependencies:
info.shibuya24.test: Version 'git@github.com:baobao/test-package.git?path=hoge' is invalid. Expected one of: a 'SemVer' compatible value; a value starting with 'file:'; a Git URL starting with 'git:' or 'git+', or ending with '.git'.

httpsプロトコルURLの場合
"info.shibuya24.test": "https://github.com/baobao/test-package.git"
エラー内容
An error occurred while resolving packages:
Project has invalid dependencies:
info.shibuya24.test: Error when executing git command. fatal: could not read Username for 'https://github.com': terminal prompts disabled
gitプロトコルURLの場合
"info.shibuya24.test":"git://github.com:baobao/test-package.git"
エラー内容
An error occurred while resolving packages:
Project has invalid dependencies:
info.shibuya24.test: Error when executing git command. fatal: Unable to look up github.com:baobao (port 9418) (nodename nor servname provided, or not known)
ユーザー名付きURLの場合
"info.shibuya24.test": "https://baobao@github.com/test-package.git"
エラー内容
An error occurred while resolving packages:
Project has invalid dependencies:
info.shibuya24.test: Error when executing git command. remote: Not Found
fatal: repository 'https://baobao@github.com/test-package.git/' not found
パスワード付きの場合
"info.shibuya24.test":"https://baobao:password@github.com/test-package.git"
※パスワードに@
がついている場合は、%40
にエスケープして置き換えます。
エラー内容
An error occurred while resolving packages:
Project has invalid dependencies:
info.shibuya24.test: Error when executing git command. remote: Not Found
fatal: repository 'https://baobao:password@github.com/test-package.git/' not found
参考

この記事が気に入ったらフォローしよう
オススメ記事