donglian7879 2019-01-08 20:57
浏览 190

在圈子ci中使用go mod获取私人仓库

I followed this and added the keys in SSH Permissions as well as the fingerprint in my circle config file.

I also added this to my ~/.gitconfig as part of my circle compile step.

[url "ssh://git@github.com/MYORGANIZATION/"]
insteadOf = https://github.com/MYORGANIZATION/

following the official recommendation

When I SSH into the circle image I can see the fingerprint being added using this command ssh-add -l -E md5. But there's no keys added in ~/.ssh/. I'd expect to have ~/.ssh/id_rsa_<fingerprint> in there.

However I still get access denied when I try to retrieve the package.

  • 写回答

1条回答 默认 最新

  • douyan1613 2019-01-09 23:11
    关注

    The easiest way to get this to work is to follow the instructions for adding a machine user: https://circleci.com/docs/2.0/gh-bb-integration/#enable-your-project-to-check-out-additional-private-repositories

    For a more complicated solution, read on.

    I recently attempted the same thing. The add_ssh_keys keys should (and did in my case) add the id_rsa_<fingerprint> file.

    The problem I ran into was that the key is added with an ssh config that contains:

    Host !github.com *
    

    I believe the problem is that it uses the default CircleCI key to authenticate with github. That key is valid, so github accepts it, but it most likely does not have access to the private repo in your dependencies.

    To get it to work what I had to do was:

    # Disable ssh-agent which seemed to override `-i`
    export SSH_AUTH_SOCK=none
    # Tell get to ssh with the key I want to use
    export GIT_SSH_COMMAND="ssh -i /root/.ssh/id_rsa_FINGERPRINT
    
    # Run some command to pull dependencies
    go test ./...
    
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。