> For the complete documentation index, see [llms.txt](https://yubico.gitbook.io/yubikey5/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yubico.gitbook.io/yubikey5/tutorials/github-desktop.md).

# Github Desktop

<figure><img src="/files/AUuBAlIFKUrgMHUm7gYu" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
This tutorial requires one device of any in the following categories:

* [x] [YubiKey 5 Series](https://www.yubico.com/store/#yubikey-5-series)
* [x] [YubiKey 5 FIPs Series](https://www.yubico.com/store/#yubikey-5-fips-series)
  {% endhint %}

This tutorial requires the following software to be installed:

<table><thead><tr><th width="285">Software</th><th>Operating System</th></tr></thead><tbody><tr><td><img src="/files/cx3UyzbMaa2qyyOJ3lWy" alt=""> <a href="https://desktop.github.com/"><strong>Github Desktop</strong></a></td><td>Windows</td></tr><tr><td><img src="/files/cx3UyzbMaa2qyyOJ3lWy" alt=""> <a href="https://gist.github.com/berkorbay/6feda478a00b0432d13f1fc0a50467f1"><strong>Github Desktop</strong></a></td><td>Linux</td></tr><tr><td><img src="/files/cx3UyzbMaa2qyyOJ3lWy" alt=""> <a href="https://gitforwindows.org/"><strong>Git</strong></a></td><td>Windows</td></tr><tr><td><img src="/files/cx3UyzbMaa2qyyOJ3lWy" alt=""> <a href="https://git-scm.com/download/mac"><strong>Git</strong></a></td><td>Mac</td></tr><tr><td><img src="/files/cx3UyzbMaa2qyyOJ3lWy" alt=""> <a href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git"><strong>Git</strong></a></td><td>Linux</td></tr></tbody></table>

## <mark style="color:red;">❊ Why Sign Commits?</mark>

Code and commit signing does two things: it confirms who the author of the software is and proves that the code has not been altered or tampered with after it was signed. Both are extremely important for building trust from customers and safely distributing your software.

## <mark style="color:red;">❊ Install Github Desktop</mark>

Github Desktop is a fairly straight-forward install. Download the program and then do a typical install.

## <mark style="color:red;">❊ Install Git (bash)</mark>

Proceed to download and start the installation for Git.

<figure><img src="/files/Ot2ORhlhjbU5Tdw7f8sa" alt=""><figcaption></figcaption></figure>

The list of options above depends on your preferences. If you are unsure of what some of these do, you can just leave them checked.&#x20;

On the next screen, Git is going to start asking a few customization options such as which editor you wish to use:

<figure><img src="/files/sP3LbFayTeROB5gyLaou" alt=""><figcaption></figcaption></figure>

I have selected Visual Studio Code, but you can select whichever one you like. If you don't have an editor installed, then you can select <mark style="color:yellow;">**Notepad**</mark>.

<figure><img src="/files/z3JtWAa0r8lOytTBKeLf" alt=""><figcaption></figcaption></figure>

For the next section, you will be asked if you would like Git to name the initial branch after \`**`git init`**\`. You can select <mark style="color:yellow;">**Let Git Decide**</mark>**.**

<figure><img src="/files/WHfw4yLZf2M2gtH1TOmI" alt=""><figcaption></figcaption></figure>

The next section will ask how you're using Git from the command-line.

It's best to choose the Recommended option: <mark style="color:yellow;">**Git from the command-line and also from 3rd-party-software**</mark>.

<figure><img src="/files/zuqXcsM5U8M5Ze0Lutlz" alt=""><figcaption></figcaption></figure>

This next section asks about your choice in SSH client. The answer to this question is going to vary depending on your needs. If you are unsure, select <mark style="color:yellow;">**Use Bundled OpenSSH**</mark>**.**

<figure><img src="/files/tZVr3uGHbyR7mhl0fjtY" alt=""><figcaption></figcaption></figure>

For HTTPS transport backend, you can select <mark style="color:yellow;">**Use the OpenSSL Library**</mark>.

<figure><img src="/files/3MOJ7PSC59rZFUfSLwgV" alt=""><figcaption></figcaption></figure>

For line-ending conversions; if you see an option that fits you specifically, then choose your best option. If you are unsure, select <mark style="color:yellow;">**Checkout Windows-style commit Unix-style line endings**</mark>**.**

<figure><img src="/files/N9SgsSzWxFCGoCIflCJA" alt=""><figcaption></figcaption></figure>

Next, select <mark style="color:yellow;">**Use MinTTY**</mark>**.**

<figure><img src="/files/510MRukzueJzbhzYU4Rx" alt=""><figcaption></figcaption></figure>

Select <mark style="color:yellow;">**Default (fast-forward or merge)**</mark>**.**

<figure><img src="/files/g0IaI0qqOWFopJD4U0qD" alt=""><figcaption></figcaption></figure>

Select <mark style="color:yellow;">**Git Credential Manager**</mark>

<figure><img src="/files/xG6z3uCh5Chr5FZawqCv" alt=""><figcaption></figcaption></figure>

Select <mark style="color:yellow;">**Enable file system caching**</mark> (unless you need symbolic links as well).

<figure><img src="/files/vt2azPpcX0JSyLMvYUJV" alt=""><figcaption></figcaption></figure>

And FINALLY... select to enable any of the options above. Or you can leave them off.

After you've gone through that endless round of button smasher, press ![](/files/N8hzwgkdczhbXxdAQ8Gj)

Once installation has finished, we'll uncheck both options so that we can do the next step:

<figure><img src="/files/Ss6r71W1nVeGptNyRyab" alt=""><figcaption></figcaption></figure>

Once you press ![](/files/eCV51RJshYPc23pyqcF8), move on to the next section.

## <mark style="color:red;">❊ Setting Environment Variables</mark>

During the installation of Git, one of the questions asked was how you want Git to manage Environment variables.&#x20;

We are going to now look at your environment variables and confirm Git did indeed add them.

Click ![](/files/m95DuYTUYStgpdxfvzYW) and type <mark style="color:red;">**Environment**</mark>.

The option <mark style="color:red;">**Edit the system environment variables**</mark> should appear.

<figure><img src="/files/hlEIXKYfPU02V0WIwyNo" alt=""><figcaption></figcaption></figure>

Once the dialog box appears on the <mark style="color:red;">**Advanced**</mark> tab, at the bottom, click ![](/files/yFkuJtoFkmZaoQVskeSM)

You should see two separate boxes labeled **USER VARIABLES** and <mark style="color:red;">**SYSTEM VARIABLES**</mark>.

In the <mark style="color:red;">**System Variables**</mark> box, locate the line which defines **Path**.

<figure><img src="/files/t8a1dmzXs7qVPSYHNsfI" alt=""><figcaption></figcaption></figure>

Highlight the <mark style="color:red;">**Path**</mark> line and then click ![](/files/TbWR3jS505PiuhthdLKC)

Read through the list of variables on each line and find one of the two mentioned here:

* <mark style="color:yellow;">**`C:\Program Files\Git\cmd`**</mark>
* <mark style="color:yellow;">**`C:\Program Files\Git\bin`**</mark>

The drive letter C: will be different for you if you told Git to install to a different drive.

If you see the above paths in your list of system environment variables, youc an close that window. However, if you do not, then you'll need to manually add them.

Select ![](/files/iH4rFpuzGNRnwPI7FgRP) on the right hand side of the new dialog window.

<figure><img src="/files/fEVxx9ACTxVXHLxFv8bi" alt=""><figcaption></figcaption></figure>

You will notice a box open up at the very bottom of the window where you can type.

In the box, enter <mark style="color:yellow;">**`C:\Program Files\Git\cmd`**</mark>

Once you enter the path to Git's bin folder, you can click ![](/files/eTFHywrDKkAOcmKisOAq)

You have now created a System Environment Variable which will become extremely useful.

To test if it works, open Command Prompt, Terminal, or Powershell in a new window. You should start in your user's home folder which is C:\Users\yourusername.

Once you have one of the above opened, type the command:

```
git --version
```

<figure><img src="/files/ZVsE1NOwMdQYTW0dFEni" alt=""><figcaption></figcaption></figure>

You should receive a response back which shows the current version of Git installed on your system.

## <mark style="color:red;">❊ Generating GPG Keys</mark>

The next step is to generate actual GPG keys that you'll import onto your Yubikey and link to your Git software.

There are several ways to generate GPG keys. Select your desired method below:

<table><thead><tr><th width="275"></th><th></th></tr></thead><tbody><tr><td><img src="/files/cx3UyzbMaa2qyyOJ3lWy" alt=""> <a href="/spaces/wDiMyl2FV0YbzWbcTioq/pages/4Ej8RuEqJKltNStpcTpJ"><strong>Generate on Yubikey</strong></a></td><td>Exporting the private key is prohibited. No other Yubikey can have that private key.</td></tr><tr><td><img src="/files/cx3UyzbMaa2qyyOJ3lWy" alt=""> <a href="/spaces/wDiMyl2FV0YbzWbcTioq/pages/24xDp1rzTMMm68aXdIBK"><strong>Generate from Software</strong></a></td><td>Allows you to export your private key and import it into multiple Yubikeys.</td></tr></tbody></table>

Once you have completed one of the guides above and have your GPG keys successfully imported to your Yubikey, please continue below:

## <mark style="color:red;">❊ Import GPG key to Github</mark>

Sign into your![](/files/cx3UyzbMaa2qyyOJ3lWy) [**Github.com**](https://github.com/) account.

Open the menu to the top right, and select <mark style="color:red;">**`Settings`**</mark>.

<figure><img src="/files/uMCxl4PWpzBhGXQL3WHH" alt=""><figcaption></figcaption></figure>

Then migrate to <mark style="color:red;">**`SSH and GPG Keys`**</mark>

<figure><img src="/files/ZDn4j0RGA1xnr2W5FCOA" alt=""><figcaption></figcaption></figure>

For a direct link, login to Github and view the ![](/files/cx3UyzbMaa2qyyOJ3lWy)[**Github SSH / GPG Keys**](https://github.com/settings/keys) page.

In the middle of the page, locate the <mark style="color:red;">**`GPG Keys`**</mark> section:

<figure><img src="/files/sflPAd29Ikf6esKCnivp" alt=""><figcaption></figcaption></figure>

On the right, select ![](/files/2rMu7PIdGQ3SNcItN7UK)

<figure><img src="/files/6LYB9Mikp0YKWNyicmmD" alt=""><figcaption></figcaption></figure>

Select a name / title for your GPG key.

For the Key field, it is requesting the GPG Public Key you generated when your keys for first made.

If you are unsure of how to obtain your GPG Public Key:

* ![](/files/cx3UyzbMaa2qyyOJ3lWy) [**Exporting Public Key with Kleopatra Application**](/yubikey5/gpg/generate-keys/with-kleopatra.md#public-keys)
* ![](/files/cx3UyzbMaa2qyyOJ3lWy) [**Exporting Public Key with GPG Command-line**](/yubikey5/gpg/generate-keys/with-commandline.md#public-key)

Once you export your Public Key, locate the file:

<figure><img src="/files/ijvH4t7LLkLSm7niEwZa" alt=""><figcaption></figcaption></figure>

Open this file in <mark style="color:red;">**Notepad**</mark> or some other text editor:

<figure><img src="/files/AK0eZIalGOfYT6hzURUl" alt=""><figcaption></figcaption></figure>

This large string of text is your <mark style="color:red;">**`PGP Public Key Block`**</mark>, which you need to copy, and then paste in the field box on Github.

<figure><img src="/files/4JH2JKi09CrEzQtRa3qQ" alt=""><figcaption></figcaption></figure>

Once you paste, click ![](/files/Li45CTGziUGmXT0Nxrpw)

You will be redirected back to the GPG page of Github:

<figure><img src="/files/g9CFN9cpikjwy9kIBGMR" alt=""><figcaption></figcaption></figure>

As you can see in the screenshot, it's advised that you create a GPG key with the same email address associated to your Github. But this is OK for our demo.

Next, we will add our keys to Git Bash / Github Desktop.

## <mark style="color:red;">❊ Git Bash / Github Desktop</mark>

We now need to tell Git bash and Github Desktop to use a key when signing commits. For reference, the commands you are going to enter below are all saved to the file:

<mark style="color:red;">**`C:\Users\yourusername\.gitconfig`**</mark>

Open <mark style="color:red;">**Command Prompt**</mark>, <mark style="color:red;">**Terminal**</mark>, or <mark style="color:red;">**Powershell**</mark>.

Execute the following command:

```powershell
git config --global commit.gpgsign true
```

Next, we will specify our <mark style="color:red;">**`Key ID`**</mark>**` ``--`** this is listed on the Github page:

```powershell
git config --global user.signingkey BB6E1E562FFFD354
```

Finally, we need to tell Git where we have GPG installed. Your path may be different depending on your installation method:

```powershell
git config --global gpg.program "C:\Program Files (x86)\GnuPG\bin\gpg.exe"
```

## <mark style="color:red;">❊ Testing Commits</mark>

Load up Github Desktop and make a change to one of your repos.

Once you are ready, commit your changes and within a few seconds you should get a dialog asking for your GPG PIN:

<figure><img src="/files/kv98WPaPqmGyuUPt5zTz" alt=""><figcaption></figcaption></figure>

Once you enter your PIN, the process should continue as it normally does and allow you to push your changes.

Git bash should work the same way when executing the command to commit.

Since most software uses the Git library, you will also be asked for a PIN when you sign commits using Visual Studio Code's git plugin.

When you view your list of commits on the repo, you should see a <mark style="color:blue;">**`Verified`**</mark> tag to the right of the commit.

<figure><img src="/files/o4mguk1gErzjUhYMoHZT" alt=""><figcaption></figcaption></figure>

If you do not use the same email address as your Github for your GPG key, you will see an <mark style="color:yellow;">**`Unverified`**</mark> tag.

<figure><img src="/files/BE2KhAuRsHv0aHgvTxsQ" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://yubico.gitbook.io/yubikey5/tutorials/github-desktop.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
