Spacemacs - Using Magit With Github

By adding the git layer to Spacemacs you have the fully featured git client called magit. The github layer allows you to clone repositories from Github and to create, list, update and delete gists

Today I discovered Magithub which can create a new remote repository on Github from within Spacemacs, using the command line tool called hub.

Previously I opened a shell inside Emacs and ran the hub create command to create a new remote Github repository for a project. This worked, but not the same speed as having a feature built-in to Magit itself.

What is Magithub

Magithub is an interface to GitHub using the `hub’ command line tool. Its integrated into Magit workflows and allows very easy, very basic GitHub repository management. Supported actions include:

  • pushing brand-new local repositories up to GitHub
  • creating forks of existing repositories
  • submitting pull requests upstream
  • viewing and creating issues

Spacemacs - Magit Status - Magithub in action

Adding magithub to Spacemacs

As Magithub.el is not part of a layer, it can be added as an additional package in the dotspacemacs/layers of the ~/.spacemacs file.

dotspacemacs-additional-packages '(magithub)

The Magithub package needs to be loaded into Spacemacs once magit has been loaded. So we need to add a hook in the dotspacemacs/user-config section of the ~/.spacemacs file

(use-package magithub
:after magit
:config (magithub-feature-autoinject t))

Using Magithub

Open magit status with SPC g s and then you have access to the magithub features.

Press `H’ in the magit status buffer and you will see the following menu

Spacemacs - Magit Status - Magithub menu

Here is a simple example of taking an unversioned project, putting under Git version control with Magit and then creating a remote repository on Github with Magithub.

Thank you.

This work is licensed under a Creative Commons Attribution 4.0 ShareAlike License, including custom images & stylesheets. Permissions beyond the scope of this license may be available at @jr0cket
Creative Commons License