GitKraken is another popular GUI that can seem intimidating at first, but it does a good job of visually representing key Git concepts, including branches. GitKraken is free for open-source use and is available for Windows, Mac, and Linux. GitKraken is a well organized graphical user interface designed to help you manage your Git repositories in style. The utility integrates most functionalities one would expect from a Git client but.
What is Commit Signing?
In Git, you may commit using any name and email address. However, Git supports signing commits and tags using a GPG key pair.
By signing a commit, other users with your public key can verify the commit was created by the owner of that key. Users can also share their public key with their remote hosting service, such as GitHub, so that commits appear as verified on their website.
Commit Signing Requirements
Before you start signing your commits, you will first need to install and configure GPG. GPG download files can be found here. Our recommendations to get GPG installed quickly are below.
Note: If you have GitKraken open, we recommend closing the application before installing GPG.
Windows:Gpg4win, simply follow the installer.
Mac: We recommend downloading GPG on Mac through Brew. Once you have brew, simply run
brew install gpg
.Linux: Install gpg through your distribution’s package manager.
- Debian/Ubuntu:
apt install gnupg
- Fedora:
dnf install gnupg2
- CentOS/RHEL:
yum install gnupg2
- Debian/Ubuntu:
Once you have installed GPG to your machine, you can verify it is installed and check the version by opening your terminal and running gpg --version
.
Note: You may need to replace `gpg` with `gpg2` if you installed GPG2 without an alias. If you have both gpg and gpg2, you will need to prefix with gpg2 if you wish to use the latter.
Generating a GPG Key In GitKraken
If you have GPG installed on your local machine, you will be able to generate a GPG key pair from within GitKraken.
Note: Make sure that you have [configured GPG inside of GitKraken](/git-workflows-and-extensions/commit-signing-with-gpg/#configure-gpg-in-gitkraken).
Under Preferences
→ GPG Preferences
, there is an option to Generate new GPG Key
. If you wish to enter a passphrase, make sure you do so prior to selecting Generate
.
Configure GPG in GitKraken
Once you have GPG installed on your machine, you will need to configure GitKraken to use GPG. Launch GitKraken and navigate to Preferences → GPG Preferences.
Signing Key: This dropdown list will contain all of your local keys. Select the key you wish GitKraken to use when signing your commits and tags. If this list is blank you can try the following troubleshoots:
- You may need to configure the GPG Program setting first.
- If you installed GPG while GitKraken was open, you may need to fully close GitKraken and re-launch it.
GPG Program: This is the location of where GPG is installed on your local machine. If GPG is on your path, GitKraken should automatically detect the GPG program. However, it is possible to have multiple installations of GPG so you can specify which one GitKraken should point to by using the button.
If you do not know where GPG is installed on your local machine, launch a terminal and enter: which gpg
for Mac & Linux. On Windows, use: where gpg
Sign Commits by Default: Enabling this checkbox will have GitKraken sign any commit you create going forward.
Sign Tags by Default: Enabling this checkbox will have GitKraken sign any tags you create going forward.
Generate new GPG Key: GitKraken will generate a new GPG key for you, see Generating a GPG Key In GitKraken.
Verifying a Local Commit is Signed
You can verify a commit has been signed by selecting a commit and viewing the commit panel. An icon will appear to the left of the commit SHA on signed commits only.
If you hover over the badge, you will see a tooltip which displays the Signature details.
Below is a list of possible signature codes and what they mean:
GOODSIG
-- The signature with the keyid is good.EXPSIG
-- The signature with the keyid is good, but the signature is expired.EXPKEYSIG
-- The signature with the keyid is good, but the signature was made by an expired key.REVKEYSIG
-- The signature with the keyid is good, but the signature was made by a revoked key.BADSIG
-- The signature with the keyid has not been verified.ERRSIG
-- It was not possible to check the signature. This may be caused by a missing public key or an unsupported algorithm.
Uploading Your GPG Key to a Remote Hosting Service
To upload your GPG public key to your remote hosting service, we recommend viewing the documentation for the respective hosting service:
- GitHub
- GitLab
- Bitbucket
To copy your GPG public key in GitKraken, navigate to Preferences → GPG Preferences and below your Signing Key, select Copy GPG Public Key
.
Editing Your GPG Key
Editing your gpg key is helpful when you wish to add another email address to a key or renew an expired key. To edit a GPG key, navigate to your terminal and enter gpg --list-secret-keys --keyid-format LONG
. This command will output a list of your GPG keys, take note of the ID of the key you wish to edit.
Now that you have the key ID, you can edit the key. To do so enter gpg --edit-key FFFFFF
where FFFFFF
is your key ID. You will then enter an editing session with your GPG key. After you update your key, execute a save
to record changes and quit editing the key.
Below is a list of useful commands to edit your key:
adduid
- Add a new user ID to the GPG keydeluid
- Delete a user ID from the GPG keytrust
- Change the owner trust value. This updates the trust database immediately and no save is required.expire
- Change a key expiration timesave
- Save all changes to the current key and quitquit
- Quit without updating the current key
For a complete list you can review GNU’s documentation.
Make sure to upload the updated key on your hosting service once you have saved. See Uploading Your GPG Key to a Remote Hosting Service.
Deleting your GPG Key
You can delete your key via terminal with the command gpg --delete-secret-keys
simply append your username or key ID.
There will be several prompts to make sure that you really want to delete your GPG key: Pivot 4.0 download the pivot corner!.
Commit to save work with GitKraken when changing files. Whether you commit to other things in life is up to you..
Making a commit
To make a commit in GitKraken, select your Work in Progress and to view recent changes on the Commit Panel.
Select the files you wish to stage, and click on any files you wish to review in the diff. To stage all your files, use the keyboard shortcut ⌘ShiftS for Mac or CtrlShiftS for Windows or Linux.
When you’re ready, type your message and hit commit to commit your changes. You can also use this Commit keyboard shortcut ⌘ + Enter for Mac or Ctrl + Enter if you are on Linux or Windows.
The graph updates with your commit, but the undo button or this keyboard shortcut⌘ + Z for Mac or Ctrl + Z for Windows/Linux can undo a commit made by mistake.
Committing with Co-Authors
To add co-authors to a commit, add a line to your commit description using the following format:
The commit panel will then show the co-author in the history for that commit:
Commit Templates
Reading the Commit Template
When you open a repository, GitKraken will first check for a commit template set up in your repository's .git/config
. If no commit template is found, it will then check your default (global) .gitconfig
. If no commit template is found there either, then no commit template will be populated in GitKraken.
Creating and Updating the Commit Template
You can create and update a commit template in GitKraken by visiting Preferences Commit Template.
If a commit template was read from your local git config, any changes you make to the template in GitKraken will save to the file specified.
If a commit template was not read from your default .gitconfig
or you are creating a template for the first time, any change you make to the template in GitKraken will be written to a file called gkcommittemplate.txt
in your repository's .git/
directory. GitKraken will also update your repository's git config commit.template
setting to point to this file. This allows you to make changes to your local commit template without overwriting your global commit template for all of your other repositories.
Checking the Apply this template to commit messages
option will automatically apply the template to the commit message pane. If this option is not checked, the commit message pane will be blank.
There are three different ways to set up commit templates in GitKraken:
Gitkraken For Mac
Create the template in GitKraken - This will create a file called
gkcommittemplate.txt
in your repository's.git/
directory. Past papers.Add a repo-specific commit template - Open a terminal in your local repository and run
git config commit.template <path_to_template>
Genesis. Add a global commit template - Open a terminal window and run
git config --global commit.template <path_to_template>
**Note:** Any changes made in GitKraken to a global commit template will cause GitKraken to create a `gkcommittemplate.txt` file in your local `.git/` directory and point your repository's git config `commit.template` setting to the `gkcommittemplate.txt` file
Amending commits
GitKraken allows you to amend a commit message, add additional changes, or both.
To add more changes, amend a commit by clicking on the //WIP node on the graph.
If you only need to update the commit message, select the most recent commit and click in the message box to amend the message.
To accommodate viewing a longer commit description, click on the bar at the the bottom of the message box and drag downwards to dynamically resize the text field.
Gitkraken Mac Slow
Select to save your changes or to discard.
Uninstall Gitkraken Mac
Note: Amending commits which are already pushed to a remote are more difficult to apply and would require a force push for the rewrite.
Resetting commits
Git keeps track of your current commit in a file called the HEAD. When resetting a commit, you update the HEAD of your repo to point to the selected commit. GitKraken offers the following reset options:
Gitkraken Mac
- Soft - resets the HEAD to the selected commit, but keeps your changes staged and in your WIP directory
- Mixed - resets the HEAD to the selected commit, unstages your changes, but keeps them in your WIP directory
- Hard - resets the HEAD to the selected commit, unstages your changes, and deletes your WIP files
You may also drag and drop a branch onto another to select from the three reset options above or access the reset options from your local repos in the left panel.
Reverting changes
Undo, undo, undo. You can undo many of your actions in GitKraken with the Undo icon.
If you're a keyboard fan, you may also enjoy using the keyboard shortcut⌘ + z for Mac or Ctrl + Z for not-Mac.
Reverting commits
If you wish to revert a commit (perhaps Undo is not available), the option is available when right-clicking on a commit node. This will create a new commit to reverse your previous changes.