Skip to content

GitLab 凭据#

¥GitLab credentials

你可以使用以下凭据验证以下节点:

¥You can use these credentials to authenticate the following nodes:

¥GitLab Trigger

支持的身份验证方法#

¥Supported authentication methods

  • API 访问令牌

¥API access token

  • OAuth2(推荐)

¥OAuth2 (Recommended)

相关资源#

¥Related resources

有关服务的更多信息,请参阅 GitLab API 文档

¥Refer to GitLab's API documentation for more information about the service.

使用 API 访问令牌#

¥Using API access token

要配置此凭据,你需要一个 GitLab 账户以及:

¥To configure this credential, you'll need a GitLab account and:

  • GitLab 服务器的 URL。

¥The URL of your GitLab Server

  • 访问令牌

¥An Access Token

要设置凭据:

¥To set up the credential:

  1. 在 GitLab 中,选择你的头像,然后选择“编辑个人资料”。

¥In GitLab, select your avatar, then select Edit profile. 2. 在左侧边栏中,选择“访问令牌”。

¥In the left sidebar, select Access tokens. 3. 选择添加新令牌。

¥Select Add new token. 4. 输入令牌名称,例如 n8n integration

¥Enter a Name for the token, like n8n integration. 5. 输入令牌的过期日期。如果你未输入过期日期,GitLab 会自动将其设置为比当前日期晚 365 天。

¥Enter an expiry date for the token. If you don't enter an expiry date, GitLab automatically sets it to 365 days later than the current date.

  • 令牌将于指定到期日的 UTC 时间午夜过期。

    ¥The token expires on that expiry date at midnight UTC. 6. 选择所需的范围。对于 GitLab 节点,请使用 api 范围轻松授予对节点所有功能的访问权限。或者,请参阅 个人访问令牌作用域,选择要使用的函数的作用域。

¥Select the desired Scopes. For the GitLab node, use the api scope to easily grant access for all the node's functionality. Or refer to Personal access token scopes to select scopes for the functions you want to use. 7. 选择“创建个人访问令牌”。

¥Select Create personal access token. 8. 复制此创建的访问令牌,并将其作为访问令牌输入到你的 n8n 凭据中。

¥Copy the access token this creates and enter it in your n8n credential as the Access Token. 9. 在你的 n8n 凭据中输入你的 GitLab 服务器 URL。

¥Enter the URL of your GitLab Server in your n8n credential.

更多信息请参阅 GitLab 的 创建个人访问令牌文档 文档。

¥Refer to GitLab's Create a personal access token documentation for more information.

使用 OAuth2#

¥Using OAuth2

Note for n8n Cloud users

Cloud users don't need to provide connection details. Select Connect my account to connect through your browser.

如果你是 self-hosting n8n,你需要一个 GitLab 账户。然后创建一个新的 GitLab 应用:

¥If you're self-hosting n8n, you'll need a GitLab account. Then create a new GitLab application:

  1. 在 GitLab 中,选择你的头像,然后选择“编辑个人资料”。

¥In GitLab, select your avatar, then select Edit profile. 2. 在左侧边栏中,选择“应用”。

¥In the left sidebar, select Applications. 3. 选择添加新应用。

¥Select Add new application. 4. 输入客户端名称,例如 n8n integration

¥Enter a Name for your application, like n8n integration. 5. 在 n8n 中,复制 OAuth 重定向 URL。将其作为 GitLab 重定向 URI 输入。

¥In n8n, copy the OAuth Redirect URL. Enter it as the GitLab Redirect URI. 6. 选择所需的范围。对于 GitLab 节点,请使用 api 范围轻松授予对节点所有功能的访问权限。或者,请参阅 个人访问令牌作用域,选择要使用的函数的作用域。

¥Select the desired Scopes. For the GitLab node, use the api scope to easily grant access for all the node's functionality. Or refer to Personal access token scopes to select scopes for the functions you want to use. 7. 选择“保存应用”。

¥Select Save application. 8. 复制生成的机器人令牌,并将其添加到 n8n 凭据中。

¥Copy the Application ID and enter it as the Client ID in your n8n credential. 9. 复制密钥,并将其作为客户端密钥输入到你的 n8n 凭据中。

¥Copy the Secret and enter it as the Client Secret in your n8n credential.

更多信息请参阅 GitLab 的 配置 GitLab 作为 OAuth 2.0 身份验证身份提供程序 文档。有关 OAuth2 和 GitLab 的更多信息,请参阅 GitLab OAuth 2.0 身份提供程序 API 文档

¥Refer to GitLab's Configure GitLab as an OAuth 2.0 authentication identity provider documentation for more information. Refer to the GitLab OAuth 2.0 identity provider API documentation for more information on OAuth2 and GitLab.