GitKraken Cli Documentation

Downloads  
Contact support  
Feedback  
GitKraken.com  
GitKraken Status  

GitKraken CLI

gk is GitKraken on the command line. It makes working across multiple repos easier with Workspaces, provides access to pull requests and issues from multiple services (GitHub, GitLab, Bitbucket, etc.), and seamlessly connects with GitKraken Client and GitLens in VS Code to visualize git information when you need it.

GitKraken CLI is available on macOS, Windows and Unix systems.

Note: GitKraken CLI is currently a preview.


Documentation

Check out the installation instructions and examples below. For command usage see the docs.


Installation

macOS

gk is available from Homebrew and MacPorts with the following command:

Homebrew:

brew install gitkraken-cli

MacPorts:

sudo port install gk

Or download it from the releases page and add it to your binaries folder:

mv ~/Downloads/gk /usr/local/bin/gk

Unix

gk is available as a downloadable binary from the releases page. Once you have it, add it to your binaries folder:

mv ~/Downloads/gk /usr/local/bin/gk

You can also download your corresponding package (.dev, .rpm) and install it with:

sudo apt install ./gk.deb

or

sudo rpm -i ./gk.rpm

Windows

gk is available from Winget with the following command:

winget install gitkraken.cli

You can also download it using Chocolately:

choco install gkcli --version=1.0.7

Or download the binary from the releases page and place the gk.exe in a desired folder. Then edit your environment variables to add it to your PATH.

  1. In Search, search for Environment Variables.
  2. Click on the Edit the system environment variables result.
  3. In the modal, click on the Environment Variables… button.
  4. In the System Variables section, scroll until you find the PATH variable. Click on it.
    • If it doesn’t exist, create a variable with the name PATH.
  5. Add the path to the gk binary at the end.

Examples

Create Workspaces to group repos

gk ws create

GitKraken workspaces associate groups of repos and set the context for helpful commands that can operate on, or get information for, multiple repos at once. There are two types of workspaces:

Local

Local Workspaces exist only on your machine.

Cloud

Cloud Workspaces are accessible on any machine, and can be connected to hosting and issue providers like GitHub and GitLab to get additional information about pull requests and issues. Share Cloud Workspaces with your team to improve onboarding with the ability to clone all repos at once. To enable this extra functionality, Cloud Workspaces require a free GitKraken account. We are continuing to evolve and improve GitKraken Workspaces and welcome any feedback.

Adding and locating repos

gk ws add-repo

This will add a new repo to a workspace either by path or remote URL.

gk ws locate

If you’re accessing a Cloud Workspace for the first time, you might need to locate the local repos on your machine. Run this command in the directory where youre repos are located so gk knows where they are.

gk ws clone

You can also clone all repos in a Workspace at once into a single directory. This is helpful for onboarding when your team works on multiple repos.

Perform git actions on multiple repos at once

gk ws [action]

In any workspace, you can perform git operations like fetch, pull, push, and checkout across all repos in the workspace.

Get pull requests and issues

gk provider add

Before fetching pull requests and issues, ensure that you have the appropriate provider (GitHub, GitLab, etc.) connected. This will open a browser to authenticate.

gk pr list

When a Cloud Workspace has a provider connected, you can list all pull requests and issues for repos in the workspace, and view details for a specific one.

gk pr view

Returns a list of all pull requests for all repos in a workspace. Type to search for a specific pull request and press enter to view details.

Pull Request Insights

gk ws insights

See the following metrics for all repositories in a Cloud Workspace. The default time period is 7 days, but can be increased to 14 days with any paid GitKraken license.

  • Average Cycle Time
  • Average Throughput
  • Merge Rate
  • Opened Pull Requests
  • Merged Pull Requests
  • Closed Pull Requests

Visual Commit Graph

gk ws graph

Open a visual graph of the repo in your current directory in either GitKraken Client or GitLens in VS Code.

Cloud Patches

What are Cloud Patches and why would you want to use them

A Cloud Patch is a Git patch that GitKraken securely stores for you so it can be easily shared with others across the GitKraken CLI, GitKraken Client, and GitLens. The patch is directly transferred from your machine into secure storage.

Cloud Patches allow the ability to engage early with your team before a pull request. They can be created as soon as you have a work in progress. This can help with collaborating on changes prior to a pull request and minimize the delay of pull request reviews.

How to setup Cloud Patches

Cloud Patches are enabled in the GitKraken CLI by default.

How to work with Cloud Patches

To work with Cloud Patches, use gk patch [command]. You can run gk patch to see all options offered and what they do.

To create a Cloud Patch, run gk patch create. You will be prompted to provide information about the patch and what it should be created from. Once the process is completed, you will be provided with a link that can be used by yourself or others to open the cloud patch in GitKraken Client or GitLens. From there, the patch can be applied in either client to work with those changes. To apply a Cloud Patch at a later time to the current repository, you can run gk patch apply.

Cloud Patches can be viewed from URLs shared to you and they can be applied to your working tree or to a new or existing branch. Simply select or open the link and then follow the prompts within GitLens or GitKraken Client to apply the Cloud Patch.

Here are some other helpful commands to be used with Cloud Patches:

  • gk patch view – preview the changes of a Cloud Patch
  • gk patch list – list all your Cloud Patches
  • gk patch delete – delete a Cloud Patch

Known issues and workarounds

What if I do not want GitKraken to host my Cloud Patches or have my Cloud Patch data stored on your servers?

We offer the ability for you to host Cloud Patches on your own AWS S3 storage instances. In order to set this up, please reach out to our support team and include the following information about your bucket:

  • Name of AWS bucket
  • AWS region the bucket is located in

    Once we have that information, we will provide you with a bucket policy that can be attached to your bucket through the Permissions Bucket Policy Editor. After that is completed, Cloud Patches will be stored on your own bucket.

Have feedback about this article? Did we miss something? Let us know!
On this page