Easily clone github repos, and optionally fork a copy with the remote named after the users github username.
M-x github-clone will prompt for a repository and directory and clone the repository as origin to that directory. It will then optionally fork the repo and add a remote named after the github user.
(github-clone "dgtized/github-clone.el" "~")
After creating an API key,
dgtized/github-clone.el will be cloned into
$HOME/github-clone.el as remote
origin. It will then prompt if the repository should be forked. If so, it will fork the repository to the user authorized by the API key. Finally a remote named after the github user will added to the local repository.
github-clone.el uses gh.el as a dependency, so it’s easiest to install via package.el.
Using the MELPA package archive,
M-x package-install [RET] github-clone [RET]
Or manually by downloading github-clone.el,
$ wget https://raw.githubusercontent.com/dgtized/github-clone.el/master/github-clone.el
And then from emacs:
M-x package-install-file path/to/github-clone.el
GitHub API Keys
~/.gitconfig to store the API keys. When the key is created it will store the key at the end of
Permissions and Revoking
If gh.el has trouble generating an API key, or it is necessary to revoke the API key, visit Application Settings. Generate a new personal access token with permissions for
user. Include permissions for
gist to maintain compatibility with gist.el.
Securing the keys
~/.gitconfig is a useful dotfile to version in a git repository. So how can we avoid storing API keys in the dotfile repo? Move the API configuration into
[github] user = $USER oauth-token = $KEY
Replace the API keys configuration in
~/.gitconfig with the inclusion below.
[include] path = ~/.gitconfig.private