<p>I am trying to use github.com/google/go-github in a script which clones a github repository and build it. I see I can <a href="https://godoc.org/github.com/google/go-github/github#RepositoriesService.GetReadme" rel="nofollow">get the README file</a>, but not sure what to use to download the contents of a repository in the same we do using git client,
git clone <a href="https://github.com/YOUR-USERNAME/YOUR-REPOSITORY" rel="nofollow">https://github.com/YOUR-USERNAME/YOUR-REPOSITORY</a></p>
<hr/>**评论:**<br/><br/>TheMerovius: <pre><p>It's a github-API client, not a git-replacement. In theory, you can basically manually implement git-clone on top of it, reading one file after the other, walking the repository…</p>
<p>But really, you should just use <code>exec.Command("git", "clone", url)</code>. Or at least use some other package that actually tries to implement git.</p></pre>ret0: <pre><p>+1 to this.</p>
<p>Having had to do something similar recently, if you are dealing with Github-isms (PRs, Issues, Teams, Status checks, etc) use go-github. If you're dealing with classical git actions (pulling, committing, pushing, etc) just use vanilla Git.</p>
<p>In the event that you have to do low-level Git object graph manipulations, you can use go-github, but I would avoid that entire problem space if possible...</p></pre>human0x1: <pre><blockquote>
<p>he event that you have to do low-level Git object graph manipulations, yo</p>
</blockquote>
<p>Yeah, my use case is pretty simple, just clone and occasionally switch to a specific branch. Thanks.</p></pre>human0x1: <pre><p>Thanks, that's what I have been doing with most of the python scripts too.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传