<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>emre şahin's digital garden 🍃 - GitHub</title>
    <link>https://emresahin.net/tags/github/</link>
    <description>Posts in the GitHub tag</description>
    <language>en</language>
    <managingEditor>contact@emresahin.net (Emre Şahin)</managingEditor>
    <lastBuildDate>Tue, 15 Sep 2026 19:46:32 +0000</lastBuildDate>
    <atom:link href="https://emresahin.net/tags/github/rss.xml" rel="self" type="application/rss+xml"/>
    <item>
      <title>My Nushell aliases for `gh` command</title>
      <published>2025-01-29T08:04:19+00:00</published>
      <updated>2025-01-29T08:04:19+00:00</updated>
      <author>Emre Şahin</author>
      <pubDate>Wed, 29 Jan 2025 08:04:19 +0000</pubDate>
      <link>https://emresahin.net/my-nushell-aliases-for--gh--command/</link>
      <guid isPermaLink="true">https://emresahin.net/my-nushell-aliases-for--gh--command/</guid>
      <description>Almost every day, I start my work by playing with my configuration. Today, I added aliases for gh (GitHub CLI) to Nushell. # List issues related to me export def ghil [] { (gh issue list --search "involves:iesahin" --json title,url) | from json } # Add a comment to an issue export alias ghic = gh...</description>
      <category>Shell</category>
      <category>Nushell</category>
      <category>nushell</category>
      <category>gh</category>
      <category>GitHub</category>
      <category>CLI</category>
      <content:encoded><![CDATA[<p>Almost every day, I start my work by playing with my configuration. Today, I added aliases for <code>gh</code> (GitHub CLI) to Nushell.</p>
<pre><code class="language-nu"># List issues related to me
export def ghil [] { 
  (gh issue list --search "involves:iesahin" --json title,url) | from json
}

# Add a comment to an issue
export alias ghic = gh issue comment

# Create an issue
export alias ghiC = gh issue create $in

# View an issue
export alias ghiv = gh issue view

# View an issue in the browser
export alias ghiw = gh issue view --web

# List PRs in a table
export def ghpl [] {
  (gh pr list --json "title,url,headRefName" ) | from json
}

# View a PR
export alias ghpv = gh pr view

# View a PR in GitHub
export alias ghpw = gh pr view --web

# Checkout a PR
export alias ghco = gh pr checkout

# Add a comment to a PR
export alias ghpc = gh pr comment

# Show changes in a PR
export alias ghpd = gh pr diff

# Add a review to a PR
export alias ghpR = gh pr review

# Create a PR
export alias ghpC = gh pr create

# Merge a PR to main
export alias ghpM = gh pr merge

# List GH CI runs in a table
export def ghrl [] {
  (gh run list --json conclusion,displayTitle,headBranch,url ) | from json 
}

# View a GH CI run
export alias ghrv = gh run view

# View a GH CI run in the browser
export alias ghrw = gh run view --web 

# View output from a failed run
export alias ghrf = gh run view --log-failed

# Search code and get results in a table
export def ghsc [] { 
  (gh search code $in --json repository,path,textMatches,url) | from json
}
</code></pre>
<p>Aliases don’t allow pipes in Nushell, so I used <code>def</code> for those that require them.</p>
<p>When there is an <code>$in</code> parameter in an alias, it expects the input from a pipe.
An issue can be created like this, for example:</p>
<pre><code class="language-nu">"Your software sucks" | ghiC
</code></pre>
<p>To search for the code copied to the clipboard and get only the URLs, you can use:</p>
<pre><code class="language-nu">pbpaste | ghsc | get url
</code></pre>
<p>To open them in different browser windows:</p>
<pre><code class="language-nu">pbpaste | ghsc | get url | each { |u| start $u }
</code></pre>
<p>I’ll add a shortcut key for this last one. It’s so quick! :D</p>]]></content:encoded>
    </item>
    <item>
      <title>SSH Keys for Multiple Accounts on GitHub</title>
      <published>2018-11-18T16:18:58+00:00</published>
      <updated>2018-11-18T16:18:58+00:00</updated>
      <author>Emre Şahin</author>
      <pubDate>Sun, 18 Nov 2018 16:18:58 +0000</pubDate>
      <link>https://emresahin.net/ssh-keys-multiple-accounts-14371-8399/</link>
      <guid isPermaLink="true">https://emresahin.net/ssh-keys-multiple-accounts-14371-8399/</guid>
      <description>I have multiple GitHub accounts, and some of these are collaborators on others. I don’t like to enter my password every time I push, so I set up SSH keys for my accounts. However, GitHub (understandably) doesn’t accept the same key for more than one account. (Otherwise, how would it know which ac...</description>
      <category>DevOps</category>
      <category>Tutorial</category>
      <category>SSH</category>
      <category>GitHub</category>
      <category>Git</category>
      <category>Config</category>
      <content:encoded><![CDATA[<p>I have multiple GitHub accounts, and some of these are collaborators on others. I
don’t like to enter my password every time I push, so I set up SSH keys for my
accounts. However, GitHub (understandably) doesn’t accept the same key for more than one
account. (Otherwise, how would it know which account is being used?)</p>
<p>Fortunately, there is a way to use the <code>~/.ssh/config</code> file to specify different keys for different
target URLs.</p>
<pre><code class="language-config"># Personal account - the default config
Host github.com
   HostName github.com
   User git
   IdentityFile ~/.ssh/id_rsa

# Work Account
Host work.github.com
   HostName github.com
   User git
   IdentityFile ~/.ssh/id_rsa_work
</code></pre>
<p>Now you can create another SSH key in <code>~/.ssh/id_rsa_work</code> and add it to your
work account. When you configure a repository, you need to specify
<code>git@work.github.com:user/repo.git</code> as the repository address rather than
<code>git@github.com:user/repo.git</code>.</p>]]></content:encoded>
    </item>
  </channel>
</rss>
