# Setting up GH

**URL:** <https://forum.access-hive.org.au/t/setting-up-gh/4294>\
**Category:** Technical\
**Tags:** knowledge-base, how-to\
**Created:** [11 March 2025 06:22 UTC](https://forum.access-hive.org.au/t/setting-up-gh/4294 "2025-03-11T06:22:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![helen](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/helen/32/2840_2.png) [@helen](https://forum.access-hive.org.au/u/helen)\
**Post date:** [11 March 2025 06:22 UTC](https://forum.access-hive.org.au/t/setting-up-gh/4294/1 "2025-03-11T06:22:21Z")

</div>

# Purpose

These instructions describe the process for setting up [GH commands](https://cli.github.com/manual/gh) on gadi. These commands make it easier to interface with GitHub but an initial setup is required.

# Prerequisites

1. A GitHub account
2. A login to gadi
3. You need to [have an NCI account](https://access-hive.org.au/getting_started/set_up_nci_account) and to join project vk83.

# gh commands

You can make the commands available by running:

```auto
module use /g/data/vk83/modules
module load system-tools/gh

```

# Setup

To [authorise with GitHub](https://cli.github.com/manual/gh_auth_login):

```auto
gh auth login

```

This will prompt for a series of responses. Select the responses used below:

```auto
? What account do you want to log into? GitHub.com
? What is your preferred protocol for Git operations on this host? HTTPS
? Authenticate Git with your GitHub credentials? Yes
? How would you like to authenticate GitHub CLI? Login with a web browser

! First copy your one-time code: XXXX-XXXX
Press Enter to open github.com in your browser... 

```

At this point you will get an error opening a browser on `gadi`:

```auto
! Failed opening a web browser at https://github.com/login/device
  exec: "xdg-open,x-www-browser,www-browser,wslview": executable file not found in $PATH
  Please try entering the URL in your browser manually

```

So open [Sign in to GitHub · GitHub](https://github.com/login/device) in your browser, authenticate with GitHub if you’re not already logged in, copy the one-time code from your terminal window and paste it in. Scroll down the page and click “authorise”. Then authentication should complete:

```auto
✓ Authentication complete.
- gh config set -h github.com git_protocol https
✓ Configured git protocol
! Authentication credentials saved in plain text
✓ Logged in as xxxxxxxxxxx

```

To check status use `gh auth status`

```auto
$ gh auth status
github.com
  ✓ Logged in to github.com account xxxxxxxxx (/home/XXX/xxxXXX/.config/gh/hosts.yml)
  - Active account: true
  - Git operations protocol: https
  - Token: gho_ ************************************
  - Token scopes: 'gist', 'read:org', 'repo'

```

---

<div class="post-metadata">

**Author:** ![atteggiani](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/atteggiani/32/212_2.png) [@atteggiani](https://forum.access-hive.org.au/u/atteggiani)\
**Post date:** [7 May 2025 23:16 UTC](https://forum.access-hive.org.au/t/setting-up-gh/4294/2 "2025-05-07T23:16:25Z")

</div>

Hi @helen,

Thank you for this useful guide!

I don’t think `gh` is available as a default on _Gadi_.  
I know an instance is available in the `vk83/payu` environment, but I am not sure that is the best one to use (for example if I don’t want any of the other dependencies in the `payu` environment but I’m only interested in `gh`).  
Which environment/module do you suggest using for it?

---

<div class="post-metadata">

**Author:** ![helen](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/helen/32/2840_2.png) [@helen](https://forum.access-hive.org.au/u/helen)\
**Post date:** [7 May 2025 23:23 UTC](https://forum.access-hive.org.au/t/setting-up-gh/4294/3 "2025-05-07T23:23:31Z")

</div>

Thanks @atteggiani. I am recommending using the payu environment (and have added this) as this is the only one I know that is readily available.

---

<div class="post-metadata">

**Author:** ![atteggiani](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/atteggiani/32/212_2.png) [@atteggiani](https://forum.access-hive.org.au/u/atteggiani)\
**Post date:** [7 May 2025 23:33 UTC](https://forum.access-hive.org.au/t/setting-up-gh/4294/4 "2025-05-07T23:33:41Z")

</div>

Thank you @helen.

I find loading the entire `payu` environment only to be using `gh` a bit unnecessary (`gh` is often needed by people that might even never use `payu`).

Could it be helpful to create a `gh` module (in `vk83`), containing only the `gh` executable, so people only needing `gh` could do something like:

```auto
module load gh

```

Currently the `payu` evironment is in a singularity container, so the `gh` executable cannot be used without loading the module.  
For example, with the `payu` module loaded, the command

```auto
which gh

```

returns `/g/data/vk83/apps/conda_scripts/payu-1.1.6.d/bin/gh`.

But without `payu` loaded (if `payu` has never been loaded within the session, otherwise the singularity instance would have been launched anyway), if you try running:

```auto
/g/data/vk83/apps/conda_scripts/payu-1.1.6.d/bin/gh help 

```

you get

```auto
/g/data/vk83/apps/conda_scripts/payu-1.1.6.d/bin/gh: line 121: /home/565/dm5220/miniconda3/bin/conda/envs/payu-1.1.6/bin/gh: Not a directory
/g/data/vk83/apps/conda_scripts/payu-1.1.6.d/bin/gh: line 121: exec: /home/565/dm5220/miniconda3/bin/conda/envs/payu-1.1.6/bin/gh: cannot execute: Not a directory

```

Is there any “easy” way to make `gh` available without loading `payu`?  
@jo-basevi

---

<div class="post-metadata">

**Author:** ![jo-basevi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/jo-basevi/32/1438_2.png) [@jo-basevi](https://forum.access-hive.org.au/u/jo-basevi)\
**Post date:** [7 July 2025 04:55 UTC](https://forum.access-hive.org.au/t/setting-up-gh/4294/5 "2025-07-07T04:55:37Z")

</div>

Just updating here to say that @Aidan and @TommyGatti have set up some general software deployments via spack which includes a `gh` module. This means `gh` can now be accessed without loading the `payu` conda environments, by running:

```auto
module use /g/data/vk83/modules
module load system-tools/gh

```

---

<div class="post-metadata">

**Author:** ![helen](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/helen/32/2840_2.png) [@helen](https://forum.access-hive.org.au/u/helen)\
**Post date:** [8 July 2025 23:56 UTC](https://forum.access-hive.org.au/t/setting-up-gh/4294/6 "2025-07-08T23:56:28Z")

</div>

Thanks! I have updated above and [here](https://forum.access-hive.org.au/t/how-to-push-your-configuration-to-github/4225) to reflect this.
