duancan2539 2019-06-13 14:06
浏览 247

在Jenkins中构建带有私有存储库中的依赖项的go项目

I'm trying to set up automated build for go projects. Most people just use github dependencies which don't need credentials. We have some internal dependencies however available on our private git central server. Credentials are needed however to have go access these.

A possible workaround would be to configure a global git variable inside our build machines / build dockers; something like:

git config --global url."https://user:password@private.git.server/".insteadOf "https://private.git.server/"

however this doesn't seem to be the best solution to me, since the password would be stored in a human-readable text file.

I think the git-credentials plugin should be able to help me out; could I maybe export GIT_TERMINAL_PROMPT=1 and let the git-credentials plugin fill in for me?

How could I make sure go get or go install gets access to our private repository in a secure way?

  • 写回答

1条回答 默认 最新

  • douyingyu5573 2019-06-13 14:16
    关注

    I use a workaround with GITHUB_TOKEN to solve this.

    1. Generate GITHUB_TOKEN here https://github.com/settings/tokens
    2. export GITHUB_TOKEN=xxx
    3. git config --global url."https://${GITHUB_TOKEN}:x-oauth-basic@github.com/mycompany".insteadOf "https://github.com/mycompany"

    This way you don't expose the password and can revoke token at any time.

    Note: Go uses http when downloading dependencies, not ssh.

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog