How-To: Access GitHub with EZSSH

Learn how to use the ezssh git command to request short-lived SSH certificates and get just-in-time access to the code in your GitHub organization, without long-lived SSH keys.

Overview - How to Access GitHub With SSH Certificates

If your organization protects its GitHub organization with SSH certificates, you use the EZSSH client to request a certificate and get just-in-time access to your code. One command gets you a short-lived certificate, and then you keep using git exactly as you do today.

Having trouble authenticating to your git repository? Check out our guide to troubleshoot EZSSH issues with GitHub.

Prerequisites for Accessing GitHub With EZSSH

  1. You have downloaded and installed the EZSSH client.
  2. Your EZSSH and GitHub administrators have connected EZSSH to your GitHub organization. This is done once per organization.

How to Access GitHub With EZSSH - Video Tutorial

Want to follow along with our video tutorial? Check out our video below where we walk you through how to access GitHub with EZSSH:

Step-by-Step Guide - How to Get a GitHub SSH Certificate With EZSSH

  1. Open your favorite terminal and run:

    ezssh git
    
  2. The first time, EZSSH asks you to sign in with your Entra ID account.

  3. EZSSH confirms with the message GitHub identity created successfully.

    EZSSH Agentless JIT Access terminal showing ezssh git command with GitHub identity created successfully confirmation message
  4. Start using your favorite git tool to commit your code!

How to Send a Git Command Through EZSSH

To save you a step, EZSSH can send a command to git for you. Add -c (or --command) and the git command to ezssh git. For example, to pull:

ezssh git -c "pull"

EZSSH takes care of using your existing certificate or getting a new one, and then calls git pull in another window.

EZSSH Agentless JIT Access terminal running ezssh git pull command with git output showing Already up to date

How to Auto-run ezssh git on Every Git Command

If you would rather not run ezssh git manually each time your certificate expires, you can have git itself call ezssh git before every SSH connection. This works on macOS, Linux, and WSL.

  1. Create a wrapper script at ~/.config/git/ezssh-git-wrapped.sh (the path can vary) with the following contents:

    #!/bin/sh
    ezssh git > /dev/null
    exec ssh "$@"
    
  2. Make the script executable:

    chmod +x ~/.config/git/ezssh-git-wrapped.sh
    
  3. Point git at the wrapper by adding this to your ~/.gitconfig:

    [core]
        sshCommand = ~/.config/git/ezssh-git-wrapped.sh
    

How to Troubleshoot GitHub Access With EZSSH

If git still asks for a key or returns Permission denied (publickey), follow our guide to troubleshoot EZSSH issues with GitHub.

🔎 Troubleshoot EZSSH With GitHub