简体   繁体   English

从私有Github存储库获取节点依赖项时,Teamcity不使用SSH密钥

[英]Teamcity not using SSH Key when fetching node dependencies from private Github repository

I'm using some private Github repositories as dependencies for my node app: 我使用一些私有的Github存储库作为我的节点应用程序的依赖项:

"dependencies": {
    "lib1": "git+ssh://git@github.com/org/repo.git",
    "lib2": "git+ssh://git@github.com/org/repo2.git",
}

For authentication with Github, I've set up a private key on GitHub and configured the SSH-Agent as a Build Feature. 为了使用Github进行身份验证,我在GitHub上设置了一个私钥,并将SSH-Agent配置为构建功能。

The node app itself is also a private Github repository. 节点应用程序本身也是私有的Github存储库。 Authentication when fetching the node app code from Github works fine, but not for any of the dependencies when running npm install : 从Github提取节点应用程序代码时的身份验证工作正常,但对于运行npm install时的任何依赖项而言,验证均无效:

[Step 2/4] npm ERR! Linux 4.4.11-23.53.amzn1.x86_64
[12:34:48]  [Step 2/4] npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
[12:34:48]  [Step 2/4] npm ERR! node v6.2.0
[12:34:48]  [Step 2/4] npm ERR! npm  v3.8.9
[12:34:48]  [Step 2/4] npm ERR! code 128
[12:34:48]  [Step 2/4] 
[12:34:48]  [Step 2/4] npm ERR! Command failed: git clone --template=/home/ec2-user/.npm/_git-remotes/_templates --mirror ssh://git@github.com/org/repo.git /home/ec2-user/.npm/_git-remotes/git-ssh-git-github-com-org-repo-git-0820d508
[12:34:48]  [Step 2/4] npm ERR! Cloning into bare repository '/home/ec2-user/.npm/_git-remotes/git-ssh-git-github-com-org-repo-git-0820d508'...
[12:34:48]  [Step 2/4] npm ERR! Host key verification failed.
[12:34:48]  [Step 2/4] npm ERR! fatal: Could not read from remote repository.
[12:34:48]  [Step 2/4] npm ERR! 
[12:34:48]  [Step 2/4] npm ERR! Please make sure you have the correct access rights
[12:34:48]  [Step 2/4] npm ERR! and the repository exists.

Step 1/4 is actually a check if the SSH-Agent is working by running ssh-add -l . 步骤1/4实际上是通过运行ssh-add -l检查SSH-Agent是否正常工作。 It prints the fingerprint of the correct key, which is registered to Github. 它打印正确密钥的指纹,该指纹已注册到Github。

Any ideas how to get this to work? 任何想法如何使它起作用? I'd rather not set up SSH keys manually on each agent, as this would defeat the purpose of any SSH configuration on the web interface. 我宁愿不要在每个代理上手动设置SSH密钥,因为这会破坏Web界面上任何SSH配置的目的。

I'm using node v6.2.0, npm 3.8.9 and TeamCity 10.0.3 (build 42434). 我正在使用节点v6.2.0,npm 3.8.9和TeamCity 10.0.3(内部版本42434)。

I was able to solve this by manually adding the SSH keys to the .ssh directory of the TeamCity server. 我可以通过手动将SSH密钥添加到TeamCity服务器的.ssh目录来解决此问题。 The keys are then used by any agent when selecting "default key" (given your key name is id_rsa ) in the VCS roots. 然后,在VCS根目录中选择“默认密钥”(给定密钥名称为id_rsa )时,任何代理程序都将使用这些密钥。

I'm still looking for a solution that uses the keys managed via the web interface for the agents, though. 不过,我仍在寻找一种使用通过Web界面管理代理的密钥的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 GitHub 操作从私有 GitHub 存储库安装 npm 模块 - Install an npm module from a private GitHub repository using GitHub Actions 如何从私有存储库(Node.js)返回Github问题 - How to Return Github Issues from Private Repository (Node.js) 使用节点js中的私钥连接ssh服务器 - connecting ssh server with private key in node js 从 nodejs 中的私有 github 存储库下载文件 - download a file from private github repository in nodejs 如何使用节点从私有仓库下载GitHub发布资源 - How to download GitHub release asset from private repo using node Node.js:使用唯一的公共密钥对客户端进行身份验证(类似于Github SSH密钥身份验证) - Node.js: Authenticate client using unique public key (Similar to Github SSH key authentication) 从node-js创建GitHub存储库 - create a GitHub repository from node-js 纱线包管理器:从私有Bitbucket存储库安装依赖项 - Yarn package manager: install dependencies from private Bitbucket repository nodegit:使用GitHub API令牌克隆私有存储库不起作用 - nodegit: cloning private repository using GitHub API token is not working 从私有存储库切换到公共存储库但 github 页面不发布站点 - Switching from Private to Public repository but github pages does not publish site
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM