pages tagged githubFeeding the Cloudhttps://feeding.cloud.geek.nz/tags/github/Feeding the Cloudikiwiki2024-02-02T19:59:07ZUsing a GitHub Gist like a git repohttps://feeding.cloud.geek.nz/posts/using-github-gist-like-git-repo/
<a href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>
2024-02-02T19:59:07Z2024-02-02T04:05:00Z
<p>A GitHub gist is backed by a regular git repository, but it's not exposed
explicitly via the user interface.</p>
<p>For example, <a href="https://gist.github.com/fmarier/b652bad2e759675e8650f3d3ee81ab08">this "secret"
gist</a> can
be cloned using this command:</p>
<pre><code>git clone https://gist.github.com/fmarier/b652bad2e759675e8650f3d3ee81ab08.git test
</code></pre>
<p>Within this <code>test</code> directory, the normal git commands can be used:</p>
<pre><code>touch empty
git add empty
git commit -a -m "Nothing to see here"
</code></pre>
<p>A gist can contain multiple files just like normal repositories.</p>
<p>In order to push to this repo, add the following <code>pushurl</code>:</p>
<pre><code>git remote set-url --push origin git@gist.github.com:b652bad2e759675e8650f3d3ee81ab08.git
</code></pre>
<p>before pushing using the regular command:</p>
<pre><code>git push
</code></pre>
<p>Note that the <a href="https://gist.github.com/fmarier/b652bad2e759675e8650f3d3ee81ab08/revisions">GitHub history
UI</a>
will not show you the normal commit details such as commit message and
signatures.</p>
<p>If you want to access the latest version of a file contained within this
gist, simply access
<a href="https://gist.githubusercontent.com/fmarier/b652bad2e759675e8650f3d3ee81ab08/raw/readme.md">https://gist.githubusercontent.com/fmarier/b652bad2e759675e8650f3d3ee81ab08/raw/readme.md</a>.</p>
Attaching files to Github issueshttps://feeding.cloud.geek.nz/posts/attaching-files-to-github-issues/
<a href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>
2021-06-11T20:43:57Z2012-06-21T03:13:00Z
<p>This is a hack to work-around the lack of support for file attachments on the Github issue tracker.</p>
<p>You can of course host your files somewhere else and link to them, but it's a bit annoying to not be able to attach files directly on a bug report because these remote files might go away in the future and make archived issues much less useful.</p>
<h3 id="Hosting_attachments_on_Github">Hosting attachments on Github</h3>
<p>To host file attachments on Github, you could create a <a href="https://github.com/repositories/new">new repository</a>, but then it would clutter up your list of personal repos. A better option is to create a new <a href="https://gist.github.com">gist</a>:</p>
<ul>
<li>use the bug title as the description (ideally with the issue number too)</li>
<li>put "temp" as the filename (it will be deleted shortly)</li>
<li>put something like "TODO" as the file content</li>
</ul>
<p>At that point, you'll have a new <a href="https://gist.github.com/2963192/9fc72900410caa726a1cf8f7c877ce8ef205d05d">throw-away repository</a> that you can clone on your local machine:</p>
<pre>
git clone git@gist.github.com:<i>2963192</i>.git gist-<i>2963192</i>
</pre>
<p>Once you've done that, delete the temporary file and add the one(s) you want:</p>
<pre>
git rm temp
git add <i>screenshot1.png</i>
git add <i>screenshot2.png</i>
...
git commit
git push
</pre>
<p>Now, visit your <a href="https://gist.github.com/2963192">gist page</a> and right-click on each attachment to get its direct URL:</p>
<pre><code>https://gist.github.com/raw/2963192/36e1ec2c185905bbfd545a30950ba060183e30ea/grant_p-s_bug.png
https://gist.github.com/raw/2963192/5f708ea14fbd75c28e5e95ee891c36894ce48f46/grant_p-s_persona_bug.png
</code></pre>
<h3 id="Embedding_remote_images_in_Github_issues">Embedding remote images in Github issues</h3>
<p>Finally, to include the above images into my <a href="https://github.com/mozilla/browserid/issues/1811">bug report</a>, here's the <a href="http://daringfireball.net/projects/markdown/syntax#img">Markdown</a> code I used:</p>
<pre><code>![BrowserID](https://gist.github.com/raw/2963192/36e1ec2c185905bbfd545a30950ba060183e30ea/grant_p-s_bug.png)
![Persona](https://gist.github.com/raw/2963192/5f708ea14fbd75c28e5e95ee891c36894ce48f46/grant_p-s_persona_bug.png)
</code></pre>
<p>Hopefully Github will at some point listen to all of the users that have been asking for this feature. In the meantime, if you don't mind the hassle, it is possible to have issues and attachments on the same site (sort of).</p>