<p>I've read a few tickets on Github about this issue, but was anyone able to make it work somehow? I'm trying to use go dep for some internal packages but it always fail / get stuck...</p>
<hr/>**评论:**<br/><br/>colek42: <pre><p>in your .gitconfig use the "insteadof" directive and always use ssh</p>
<pre><code># Enforce SSH
[url "ssh://git@github.com/"]
insteadOf = https://github.com/
[url "ssh://git@gitlab.com/"]
insteadOf = https://gitlab.com/
[url "ssh://git@bitbucket.org/"]
insteadOf = https://bitbucket.org/
</code></pre>
<p>ref: <a href="https://stackoverflow.com/questions/11200237/how-do-i-get-git-to-default-to-ssh-and-not-https-for-new-repositories">https://stackoverflow.com/questions/11200237/how-do-i-get-git-to-default-to-ssh-and-not-https-for-new-repositories</a></p></pre>zelenin: <pre><p>gogs/gitea with custom ssh port:</p>
<pre><code>[url "ssh://git@git.domain.com:10022/"]
insteadOf = https://git.domain.com/
</code></pre></pre>Thaxll: <pre><p>This what I have but for some reason the git CLI is stuck during git ls-remote / git-upload-pack ... :/</p></pre>condanky: <pre><p>Hey, what I have done is created a constraint in the .toml file and set the repo source with a github token. For example <code>https://<token>@github.com/owner/repo.git</code> That way dep will be able to download the repo. I haven't experimented with using a ssh key though.</p></pre>Thaxll: <pre><p>Unfortunately it's not for github :/ This issue only applies for stash / gitlab / bitbucket</p></pre>PurplrGecko: <pre><p><a href="https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md#constraint" rel="nofollow">https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md#constraint</a></p>
<p>dep use installed git tool to download dependencies</p></pre>d1mk0: <pre><p>As @PurpleGecko mentioned it's using local git command. </p>
<p>What I've done is setup ssh-agent and added ssh key. Then go dep/get worked just fine for me. For example if you have ssh key in ~/.ssh/private-repo then:</p>
<p><code>
$ ssh-add ~/.ssh/private-repo
</code></p>
<p>Also, if you do it in the docker and you can't interact with console then you would need to add host to known_hosts before adding key. Below is example for bitbucket. </p>
<p><code>
$ ssh-keyscan bitbucket.org >> ~/.ssh/known_hosts
</code></p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传