https://github.com/nezteb/git-account-switcher
https://github.com/nezteb/git-account-switcher
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/nezteb/git-account-switcher
- Owner: Nezteb
- License: apache-2.0
- Created: 2019-04-29T23:56:13.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-30T16:31:44.000Z (over 7 years ago)
- Last Synced: 2024-05-02T01:58:16.831Z (over 2 years ago)
- Language: Go
- Size: 10.7 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Git Account Switcher
The original script I wrote for this is `git-account-switcher.sh`. It is bad; it only works for two accounts and requires setting environment variables.
# TODO
- Implement `help`, `add`, `remove`, `switch`.
- Figure out how to store usernames, key locations. Probably a config file.
- Figure out how to check current git account. Probably with SSH key parsing (like the script does).
# Future Documentation
So far this is only targeting Github accounts via SSH. Other providers and HTTPS will come later.
To build/install: `make`
Fun fact: any executable in your PATH named `git-` is automatically retrieved by `git` so you can run it as a subcommand: `git `.
- `git-myCommand` -> `git myCommand`
- `git-doMagic.sh` -> `git doMagic`
- And so on.
In this case, this repo is named `git-account-switcher`, but the command is `git-account`, so you would run it as: `git account`.
Basic usage: `git account help`
Subcommands:
- `git account init {name}`
- Initialize the tool with the currently active git account and name it `{name}`.
- Not required to run, but convenient.
- `git account list`
- Returns a list of all accounts registered with the tool.
- `git account add {name}`
- Add a new account and name it `{name}`.
- `git account remove {name}`
- Remove the account with the name of `{name}`.
- `git account switch {name}`
- Switch to the registered account with the name of `{name}`.
`init`, `add`, and `switch` will fail if the given name is already regisetered.
`remove` will fail if the given name is not already registered.