npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

git-account-switch-ssh

v1.2.3

Published

Git Account Switch (SSH)

Downloads

9

Readme

Installation

npm i -g git-account-switch-ssh

Features

  • Add a git account and setup SSH keys
  • Link an account per repository
  • Clone a repository per account

Usage

Link SSH to an existing repository

Demo

If you already have an existing repository cloned locally, you can set a specific git account to interact with it's remote. Feel free to switch back and forth from one git account to another if they both have access to the remote repository. Run the command below to select an existing account with SSH access, or add a new git account and easily setup it's SSH keys. Once you've added or selected an account, a few things will be set in your project's local git config:

  1. Your full name will be set and used for future commits.
  2. Your primary email for the selected git account will be set and used for future commits.
  3. An sshCommand will be set, linking the appropriate SSH keys for your selected git account. This will allow SSH access to git pull, git push, git fetch, etc.

Within an existing git repository

gas

[!IMPORTANT] When setting up an account with SSH keys, your passphrase is never stored and instead passed as an argument to ssh-keygen. You can chose whether or not you'd like to add your passphrase to Apple Keychain. If you opt out, you will be prompted to enter your passphrase when making requests to your remote repository.

Clone a new repository and link SSH

Demo

If you want to clone a new repository, you can select or add a git account to do so. By cloning with a specified account, the repository will already be configured with SSH. If at any time you want to make commits from another git account, simply run gas in the root of the project and select another one. The CLI will use a custom command to clone the repository based on the account you've selected. Once cloning completes, a few things will be set in your project's local git config:

  1. Your full name will be set and used for future commits.
  2. Your primary email for the selected git account will be set and used for future commits.
  3. An sshCommand will be set, linking the appropriate SSH keys for your selected git account. This will allow SSH access to git pull, git push, git fetch, etc.

Outside of a git repository

gas

Restore to original SSH configuration

Demo

If you'd like to restore your computer to the original SSH configuration you had before using Git Account Switch, simply run the command below. Here are the cleanup steps you can expect:

  1. Your original SSH config will be restored to what it was before running this CLI. Any configurations created from Git Account Switch will be undone.
  2. The SSH keys generated from this CLI will be deleted. If you had any SSH keys generated before using this CLI, they'll remain in place.
  3. The Git Account Switch cache will be removed - ~/.gascache.json
gas restore

License

MIT © Eric Vandenberg

Future Improvements

  • remove an account

    • confirm delete
    • remove from known_hosts? keep in known_hosts.old
    • remove all lines from ssh config
    • create new backup?
    • remove old keys
  • update an existing account with new SSH keys

    • choose account
    • account check
    • remove old keys
    • generate keys with unique identifier
    • find and replace in ssh config
  • GPG keys

    • add GPG keys
    • sign commits
    • sign tags