Skip to main content

Automatic generation of SSH keys for VCS

Project description

py-gitsshgen

Automatic generation of SSH keys for VCS

Why?

I was incredibly tired of doing the same procedure over and over for dozens of different VCS hosted in cloud and on-prem. There was no full-pledge solution offered even in hub and lab for end-to-end setup of SSH key for login to Git across different platforms.

How to use?

The script generates RSA 4096 bits keypair and pushes public key to VCS using PAT (Personal Access Token) or App Password (Bitbucket only). The private key automatically goes to ~/.ssh/{name}.pem + reference to it is appended to ~/.ssh/config for automatic pickup by Git with OpenSSH configuration. The setup is assumed OpenSSH always.

You can install it using pip
pip install gitsshgen

All actions are done interactively in terminal:

usage: gitsshgen [-h] [-t T] [-api API_URL] [-n N] [-b BITS] [-re RSA_EXPONENT] [-sl SSH_LABEL] {github,gitlab,bitbucket,gogs,gitea} url u

positional arguments:
  {github,gitlab,bitbucket,gogs,gitea}
                        instance type
  url                   instance url
  u                     instance username

optional arguments:
  -h, --help            show this help message and exit
  -t T                  personal application token
  -api API_URL          API URL endpoint
  -n N, --name N        name for private key
  -b BITS, --bits BITS  bits size for RSA key
  -re RSA_EXPONENT, --rsa-exponent RSA_EXPONENT
                        rsa exponent for RSA key
  -sl SSH_LABEL, --ssh-label SSH_LABEL
                        ssh label in VCS

Example with token:
python create_ssh_key.py bitbucket bitbucket.org -u testusername -t testtoken

If you don't provide token, script will open browser on page where you can make one, and ask you to enter it.
python create_ssh_key.py bitbucket bitbucket.org -u testusername

VCS Compatibility

  1. Github
  2. Gitlab
  3. Gogs
  4. Bitbucket
  5. Gitea

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gitsshgen-1.2.1.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

gitsshgen-1.2.1-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file gitsshgen-1.2.1.tar.gz.

File metadata

  • Download URL: gitsshgen-1.2.1.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.1

File hashes

Hashes for gitsshgen-1.2.1.tar.gz
Algorithm Hash digest
SHA256 e9ef72c9c80fdf647a0072e6028cd49fa0ea858882494324460d95b1f93da9df
MD5 e1d529b83b6194e1deab27073920d382
BLAKE2b-256 67b96696d9a59b12562382d5cb1498cb10bd957f765a5453d7160461b83e4190

See more details on using hashes here.

File details

Details for the file gitsshgen-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: gitsshgen-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 12.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.1

File hashes

Hashes for gitsshgen-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 05b41784c221e49b9dfedb845504cdb491133966357f386a3a58d35ebf29599f
MD5 1e80c1ae844b30cb673194f57d8fbaca
BLAKE2b-256 7af972f9d7a05696a16e6243c8a790161ca4e3afb8293681ffa8d49ce5b97652

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page