6 releases (2 stable)

21.0.0 Feb 23, 2024
1.1.0 May 21, 2024
1.0.0 Feb 23, 2024
0.4.1 Jan 13, 2023
0.3.1 Oct 30, 2022

#542 in Development tools

GPL-3.0 license

26KB
349 lines

saint-peter

git ssh key-store manager

Why & How

Having multiple github accounts is not supported easily by the git cli tool, this tool provides that functionality.

It stores keyname, username, email and ssh-key, when switching key it will also switch the username and email, so that you won't push using the wrong account.

Installation

cargo build --release
sudo install target/release/saint-peter /usr/bin/saint-peter

Or from crates.io:

cargo install saint-peter

Use ~/.ssh/SAINT_PETER_GIT_KEY in your configuration to use saint-peter as key-store.

NOTE: you can change the above key position using the --output-file option. [default: ~/.ssh/SAINT_PETER_GIT_KEY]


Here an example:
inside the file `~/.ssh/config`
Host github.com
   HostName github.com
   User git
   IdentityFile ~/.ssh/SAINT_PETER_GIT_KEY

Usage

Generate and add a new key to the store
saint-peter add \
    --name <username> \
    --email <email> \
    <keyname>
Add existing key to saint-peter store
saint-peter add-existing \
    --name <username> \
    --email <email> \
    --file ~/.ssh/<ssh_key_name> \
    <keyname>

NOTE: The old file can be deleted as it is stored inside the internal store

Set current repo config permanently
saint-peter set-current <keyname>
Use key
saint-peter use <keyname>
Get pubblic key
saint-peter get-pub <keyname>

NOTE: Useful in order to add the key to a service like github

Delete saved key
saint-peter delete <keyname>

Edit configuration

The configuration is in plain json, if one need to change any of the data, like username or email, it can be done easily in the stored json.

NOTE: position of this file can be changed with the --config option [default: ~/.config/saint-peter.json]

Dependencies

~12–23MB
~387K SLoC