<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Kyle M. Douglass (Posts about github)</title><link>https://kylemdouglass.com/</link><description></description><atom:link href="https://kylemdouglass.com/categories/github.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><copyright>Contents © 2024 &lt;a href="mailto:kyle.m.douglass@gmail.com"&gt;Kyle M. Douglass&lt;/a&gt; 
&lt;a rel="license" href="https://creativecommons.org/licenses/by-nc-sa/4.0/"&gt;
&lt;img alt="Creative Commons License BY-NC-SA"
style="border-width:0; margin-bottom:12px;"
src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png"&gt;&lt;/a&gt;</copyright><lastBuildDate>Fri, 04 Oct 2024 12:52:24 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>GitHub CLI Authorization with a Fine-grained Access Token</title><link>https://kylemdouglass.com/posts/github-cli-authorization-with-a-fine-grained-access-token/</link><dc:creator>Kyle M. Douglass</dc:creator><description>&lt;p&gt;It is a good idea to use fine-grained access tokens for shared PCs in the lab that require access to private GitHub repos so that you can restrict the scope of their use to specific repositories and not use your own personal SSH keys on the shared machines. I am experimenting with the GitHub command line tool &lt;code&gt;gh&lt;/code&gt; to authenticate with GitHub using fine-grained access tokens and make common remote operations on repos easier.&lt;/p&gt;
&lt;p&gt;Today I encountered a subtle problem in the &lt;code&gt;gh&lt;/code&gt; authentication process. If you set the protocol to &lt;code&gt;ssh&lt;/code&gt; during login, then you will not have access to the repos that you granted permissions to in the fine-grained access token. This can lead to a lot of head scratching because it's not at all clear which permissions map to which git operations. In other words, what you think is a specific permissions error with the token is actually an authentication error.&lt;/p&gt;
&lt;p&gt;To avoid the problem, be sure to specify &lt;code&gt;https&lt;/code&gt; and not &lt;code&gt;ssh&lt;/code&gt; as the protocol during authentication:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;&lt;span class="go"&gt; echo "$ACCESS_TOKEN" | gh auth login -p https --with-token&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;</description><category>github</category><guid>https://kylemdouglass.com/posts/github-cli-authorization-with-a-fine-grained-access-token/</guid><pubDate>Fri, 04 Oct 2024 12:18:48 GMT</pubDate></item></channel></rss>