1.2. Git 存储库身份验证


您可以为 Git 存储库定义以下类型的身份验证:

  • 基本身份验证(Basic authentication)
  • Secure Shell (SSH)身份验证

您还可以在 Build CR 中使用两种类型的身份验证配置 Git secret。

1.2.1. 基本身份验证(Basic authentication)

使用基本身份验证,您必须配置 Git 存储库的用户名和密码。以下示例显示了对 Git 的基本身份验证的使用:

apiVersion: v1
kind: Secret
metadata:
  name: secret-git-basic-auth
  annotations:
    build.shipwright.io/referenced.secret: "true"
type: kubernetes.io/basic-auth 
1

stringData: 
2

  username: <plaintext_username>
  password: <plaintext_password>
1
Kubernetes secret 的类型。
2
以明文形式存储用户名和密码的字段。
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部