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

@savaryna/git-add-account

v2.0.2

Published

๐Ÿ” A small CLI app that allows you to easily add multiple GIT accounts on one machine. It switches between accounts automatically based on the workspace (directory/subdirectory) you are in.

Downloads

21

Readme

@savaryna/add-git-account

๐Ÿ” A small CLI app that allows you to easily add multiple GIT accounts on one machine. It switches between accounts automatically based on the workspace (directory/subdirectory) you are in.

Usage

Run the command direcly with

npx @savaryna/git-add-account

or if you want, first install it globally

npm i -g @savaryna/git-add-account

then you can run it using

git-add-account

or

gaa

After going through all the steps, you will be presented with your public SSH key so you can copy, and add it to your GIT provider. For example GitHub^1:

  1. Go to your account settings / keys
  2. Click on New SSH key
  3. Give it a title
  4. Choose Authentication Key for key type
  5. Paste in the public SSH key copied earlier in the key field
  6. Click on Add SSH key
  7. Repeat steps 2 through 6 to add a Signing Key key type, if you chose to sign your work (Commits, Tags, Pushes)^2
  8. Done! Now, you can go to the workspace you chose for the account, ex: cd /Users/john/code/work, and all the git commands issued from this, or any other subdirectory, will automatically use the correct account/ssh keys.

Example of how it works

A simple way to use multiple git accounts on one machine is to use different SSH configs based on the directory you are in. The way @savaryna/add-git-account works is, it asks you for some basic information and then it creates some files under .config in the workspace directory you specified. Ex:

  1. It creates a (private/public) SSH keypair using ssh-keygen -t ed25519 -C "[email protected]" -f /Users/john/code/work/.config/id_ed25519_git_github_com. See code.

  2. It creates a sshconfig file. See code.

    # File at /Users/john/code/work/.config/sshconfig
    # Config for GIT account [email protected]
    Host github.com
      HostName github.com
      User git
      AddKeysToAgent yes
      UseKeychain yes
      IdentitiesOnly yes
      IdentityFile /Users/john/code/work/.config/id_ed25519_git_github_com
  3. It creates a gitconfig file. See code.

    # File at /Users/john/code/work/.config/gitconfig
    # Config for GIT account [email protected]
    [user]
      name = John Doe
      email = [email protected]
    [core]
      sshCommand = ssh -F /Users/john/code/work/.config/sshconfig
    [gpg]
      format = ssh
    [commit]
      gpgsign = true
    [push]
      gpgsign = if-asked
    [tag]
      gpgsign = true
    [user]
      signingkey = /Users/john/code/work/.config/id_ed25519_git_github_com
  4. It runs git config --global includeIf.gitdir:/Users/john/code/work/.path /Users/john/code/work/.config/gitconfig, this makes sure that as long as you are in the workspace created earlier, or any other subdirectory, git will use the config from step 3 automatically^3. See code.

  5. And finally, it presents you with your public SSH key so you can copy it and add it to your GIT provider of choice.

License

MIT ยฉ Alex Tofan