Code Monkey home page Code Monkey logo

git_ssh-account_switch's Introduction

Git_SSH-Account_Switch

A CLI tool can switch ssh account to your current shell. You will easily switch to your git account & ssh key when using the server, and using your account to manipulate the project on the server.

NOTE: This tool is for the user who using Zsh on the UNIX/Linux platfrom.

Installation

$ bash ./setup.sh

it will add some code in your profile & $logout_profile, and setup git-acc & .gitacc on the $HOME.
file:

git-acc.sh -> $HOME/.git-acc, git-acc function.
.gitacc -> $HOME/.gitacc, save info. that regist on git-acc.

Control

        +---------------+
        |    git-acc    |
        +---------------+

SYNOPSIS

  git-acc [account]|[option]

OPTIONS

  [account]               use which accounts on this shell, type the account name that you register.
  -h, --help              print help information.
  -add, --add_account     build git_account info. & ssh-key.
      -t, --type          ssh-key types, follow `ssh-keygen` rule, 
                          types: dsa | ecdsa | ecdsa-sk | ed25519 | ed25519-sk | rsa(default)
  -rm, --remove_account   remove git_account info. & ssh-key from this device
  -out, --logout          logout your current ssh-acc.


EXAMPLES

  $ git-acc tw-yshuang

SWITCH ACCOUNT

When you want to use the account that you have already added it, you can type:

$ git-acc <tab>

Then it will come out the current account that registers in the git-acc to let you choose, e.g.

$ git-acc <tab>
tw-yshuang cool-name ...

ADD

$ git-acc -add
    or
$ git-acc --add_account

It will ask you to type:

Enter your git user name: <acc_name>
Enter your git user mail: <acc_mail>

After that, git-acc will generate id_rsa_<acc_name>, id_rsa_<acc_name>.pub in the $HOME/.ssh.
Next, you can type $ git-acc <acc_name>, to login your account.
NOTE: You also can overwrite your account.

CHOOSE YOUR SSH-KEY TYPE

If you do not want to use rsa type to create your ssh-key, you can use this:

$ git-acc -add -t <key-type>
    or
$ git-acc -add --type <key-type>

This args is following ssh-keygen -t rule, you can type corresponding key type you wnat!
Types: dsa | ecdsa | ecdsa-sk | ed25519 | ed25519-sk | rsa(default)

REMOVE

$ git-acc -rm
    or
$ git-acc --remove_account

It will ask you to type:

Enter the git user name you want to remove: <acc_name>

LOGOUT

$ git-acc -out
    or
$ git-acc --logout    

Logout your ssh-acc perfectly at CLI mode.

git_ssh-account_switch's People

Contributors

tw-yshuang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.