操作方法:Teamcity + GitHub

发布于 2024-07-19 06:35:56 字数 216 浏览 2 评论 0原文

有人成功配置 Teamcity 以从 GitHub 进行监控、提取和构建吗?

我似乎不知道如何在哪里以及如何配置 Teamcity 的 SSH 密钥。 我将 Teamcity 作为系统服务在系统帐户下运行。 那么 Teamcity 将其 SSH 配置存储在哪里?

编辑

为了使其正常工作,我需要停止代理在系统帐户下运行。

Has anybody successfully configured Teamcity to monitor, extract, and build from GitHub?

I can't seem to figure how where and how to configure the SSH keys for Teamcity. I have Teamcity running as a system service, under a system account. So where does Teamcity stash its SSH configuration?

EDIT

To get this to work, I needed to stop the agent from running under a system account.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

风吹短裙飘 2024-07-26 06:35:56

好的...我已经开始在我的 Windows 服务器上工作了。 以下是我配置 TeamCity 4.5 Professional 所采取的步骤:

  1. 下载了 JetBrains Git VCS Plugin
  2. 将下载的 zip 文件复制到
  3. 管理中的 .BuildServer\plugins ; 编辑构建配置> 编辑 VCS 根配置屏幕,我选择“Git (JetBrains)”
  4. 从 GitHub 项目页面输入我的克隆 URL
  5. 设置身份验证方法“默认私钥”——这很重要
    1. TeamCity BuildAgent 应以标准用户身份运行,并为该用户正确配置 SSH 安装。
    2. 按照 GitHub SSH 说明进行 SSH 配置
  6. 将用户名留空。 这应该已经在您的 GitHub 克隆 URL 中提供

Ok... I got this to start working on my Windows server. Here are the steps I took to configure TeamCity 4.5 Professional:

  1. Downloaded the JetBrains Git VCS Plugin
  2. Copied the downloaded zip file to .BuildServer\plugins
  3. In the Administration > Edit Build Configuration > Edit VCS Root configuration screen, I selected "Git (JetBrains)"
  4. Entered my Clone Url from the GitHub project page
  5. Set for authentication method "Default Private Key" -- this is IMPORTANT
    1. The TeamCity BuildAgent should be running as a standard user, with the SSH installation configured properly for that user.
    2. Follow the GitHub SSH directions for SSH configuration
  6. Leave the username blank. This should already be provided for in your GitHub clone URL
堇年纸鸢 2024-07-26 06:35:56

我获得了“默认私钥”来与 Windows 上以 SYSTEM 用户身份运行的代理一起使用。 对我来说,答案是将身份文件放在

C:\Windows\SysWOW64\config\systemprofile\.ssh\id_rsa

而不是

C:\Windows\System32\config\systemprofile\ .ssh\id_rsa

I got "Default Private Key" to work with agents running as the SYSTEM user on Windows. For me, the answer was having the identity file at

C:\Windows\SysWOW64\config\systemprofile\.ssh\id_rsa

instead of at

C:\Windows\System32\config\systemprofile\.ssh\id_rsa

乄_柒ぐ汐 2024-07-26 06:35:56

您的问题特定于 SSH,但使用 HTTP over TLS 肯定更容易、更快捷,因为 GitHub 和 TeamCity 现在都支持 HTTP 身份验证。 此外,GitHub 还支持具有有限权限的个人 api 令牌,您可以配置这些权限根据您的喜好,或者根据您的喜好创建一个新用户。

请参阅下图,了解我们的 TeamCity 设置。

Teamcity 配置

Your question is specific to SSH, but it is certainly easier and quicker to use HTTP over TLS, as GitHub and TeamCity both now support HTTP authentication. Furthermore, GitHub also supports personal api tokens with limited permissions, that you may configure to your liking, or create a new user if you prefer.

See image below of our TeamCity settings.

Teamcity configuration

倾听心声的旋律 2024-07-26 06:35:56

从 TeamCity 8.1 开始,官方支持 SSH 密钥管理,请阅读此文档: https://confluence.jetbrains.com/display/TCD9/SSH+Keys+Management

Since TeamCity 8.1, there is an official support for SSH key management, please read this docs: https://confluence.jetbrains.com/display/TCD9/SSH+Keys+Management

诗化ㄋ丶相逢 2024-07-26 06:35:56

对于私钥,用户名必须为空。

for private key, username must be blank.

瞎闹 2024-07-26 06:35:56

(这是对一个老问题的最新答案)

我使用 github/gitlab 和 teamcity 7 进行了基于 ssh 的构建,如下所示:

登录到 teamcity 计算机并使用 puttygen/ssh-keygen 生成 rsa 密钥对并保存openssh key 在某个合理的地方。
(问题 - 使用 puttygen?确保私钥采用 openssh 格式 - puttygen > conversions > export openssh key)

我建议您将私钥保存在

C:\.ssh\id_rsa

现在在 teamcity 中设置“默认私钥” - 创建一个文件

C:\.ssh\config

并在其中放置此:

Host * IdentityFile c:\.ssh\id_rsa

登录到您的 gitlab/guthub 帐户并粘贴 openssh 公钥作为您的 teamcity 私钥。

您现在应该能够在 teamcity 中创建 git vcs 根目录,该根目录可以使用默认私钥来提取源代码。

(This is a up to date answer to an old question)

I got ssh based builds working with github/gitlab and teamcity 7 like this:

Log onto the teamcity machine and use puttygen/ssh-keygen to generate a rsa key pair and save the openssh key somewhere sensible.
(Gotcha - Using puttygen? Make sure the private key is in openssh format - puttygen > conversions > export openssh key)

I suggest you save the private key in

C:\.ssh\id_rsa

Now setup "default private key" in teamcity - create a file

C:\.ssh\config

And in it place this:

Host * IdentityFile c:\.ssh\id_rsa

Login to your gitlab/guthub account and paste in the openssh public key for your teamcity private key.

You should now be able to create a git vcs root in teamcity that can use the default private key to pull your source.

德意的啸 2024-07-26 06:35:56

您可能需要像这个这样的第三方插件

You may need a third party plugin like this

凉风有信 2024-07-26 06:35:56

我不知道为什么,但选择默认私钥对我来说失败了。

然后我选择自定义私钥,如下屏幕截图所示:
输入图片此处描述

用户名字段必须为空。

Passphrase 字段是您的私钥的密码

(假设您已经在 git 中添加了该私钥的公钥。)

希望没有人像我一样被卡住!

I don't know why but choosing Default Private Key failed to me.

Then I choose to Custom Private Key as screen shot below:
enter image description here

The Username field has to be empty.

The Passphrase field is the password of the your private key

(Assume you have added the public key of this private key in git already.)

Hope no one got stuck like me !

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文