This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.3.4.2.4. 从 .gitconfig 文件为安全 Git 创建 secret
如果 Git 服务器使用双向 SSL 和用户名加密码进行保护,您必须将证书文件添加到源构建中,并在 .gitconfig
文件中添加对证书文件的引用。
先决条件
- 您必须具有 Git 凭证。
流程
将证书文件添加到源构建中,并在 gitconfig
文件中添加对证书文件的引用。
-
将
client.crt
、cacert.crt
和client.key
文件添加到应用程序源代码的/var/run/secrets/openshift.io/source/
目录中。 在服务器的
.gitconfig
文件中,添加下例中所示的[http]
部分:cat .gitconfig
# cat .gitconfig
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 输出示例
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 创建 secret:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
重要
为了避免必须再次输入密码,需要在构建中指定 source-to-image(S2I)镜像。但是,如果无法克隆存储库,您仍然必须指定用户名和密码才能推进构建。