你能从 Team Services git repo `npm install` 吗?

Can you `npm install` from Team Services git repo?

我可以成功

git clone https://[org].visualstudio.com/_git/[repo]  

但如果我 运行

npm install https://[org].visualstudio.com/_git/[repo] --save  

我明白了

npm ERR! fetch failed https://[org].visualstudio.com/_git/[repo]  
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 203  

是否可以像从 github 一样从 Team Services git 存储库安装 npm 包?

如果你想从特定的 Git 仓库安装一个包,你需要按如下方式构建 URL,注意 url 前面有 git+https://

npm i --save git+https://[org].visualstudio.com/_git/[repo]

如果您想通过 ssh 安装您的存储库,这也适用

npm i --save git+ssh://git@github.com:<owner>/<repo>

您也可以将这些样式库 URL 添加到您的 package.json 依赖项中

"dependencies": {
  "custom-pkg": "git+https://[org].visualstudio.com/_git/[repo]"
}

您可以在 npm install docs

中阅读有关使用 npm 直接从 git 安装的不同方法的更多信息

如果要安装特定分支,可以运行:

npm install git+https://[org]@dev.azure.com/[org]/Products/_git/[repo]#[branch]