Skip to main content

Github Desktop Multi account switcher

Project description

pyGitSwitch

GitHub Desktop Multi-account switcher

-----------------------------------------------------

➤ Why :

https://github.com/desktop/desktop/issues/3707 Since GitHub Desktop doesn't natively support multiple accounts.

So users often have to log out and log back into their work and personnel accounts and re-add the repos they're working on.

This aims to solve that problem by keeping a copy Roaming\Github Desktop for each user and then renaming the folder when asked and rename the folder back when switching to a new user. (records kept track using ~/gitswitch.json file)

-----------------------------------------------------

➤ How :

  • Make user login with each account in setup (init) process.
  • rename .gitconfig and GitHub Desktop folder with username at the end.
  • When the switch method is called rename the user folder to GitHub Desktop and copy over the .gitconfuser file to .gitconf.
  • update the ~/gitswitch.json with the current user details.

-----------------------------------------------------

➤ FAQ

  • Q: Does this work on Linux / macOS ?
Answer No, this script only supports windows for now. Feel free to open a pull request if you have a patch for Linux / macOS
  • Q: How do you use this?
Answer Check the installation section below.

-----------------------------------------------------

➤ Installation

Python

  • With Python >= 3.6
pip install pyGitSwitch

or install the latest development branch using

pip install git+https://github.com/AnvithLobo/pygitswitch

Windows

  • Windows Standalone exe

Download the exe from releases (TBD) and add the exe and add the containing folder to your PATH

https://stackoverflow.com/questions/44272416/how-to-add-a-folder-to-path-environment-variable-in-windows-10

-----------------------------------------------------

Init

  • Run gitswitch init (First run only)
$ gitswitch init --help
usage: gitswitch init [-h] [-c USERNAME] [-u USERNAME [USERNAME ...]]

options:
  -h, --help            show this help message and exit
  -c USERNAME, --current-user USERNAME
                        Store current user login as (do not delete current user)
  -u USERNAME [USERNAME ...], --users USERNAME [USERNAME ...]
                        all usernames separated by space
$ gitswitch init -c user1 -u user2 user3
$ gitswitch init -u user1 user2

-----------------------------------------------------

Switch

  • Run account switcher
$ gitswitch switch --help
usage: gitswitch switch [-h] [-d]

options:
  -h, --help            show this help message and exit
  -d, --do-not-start-github
                        Do NOT Start GitHub after switching account
$ gitswitch

Stopping Github Process...

Select Account  (Current User: User1)
----------------------------------------

1. User1
2. User2
3. User3

 Enter Your Choice (1-3) : 3
---------------


Switching account to user : User3

Done

just running gitswitch without any arguments will trigger the switch command by default

-----------------------------------------------------

Add User/s

  • Add more users.
$ gitswitch adduser -h
usage: gitswitch adduser [-h] USERNAME [USERNAME ...]

positional arguments:
  USERNAME

options:
  -h, --help  show this help message and exit
$ gitswitch adduser user4 user5
$ gitswitch adduser user6

-----------------------------------------------------

Delete User/s

  • Delete user/s.
$ gitswitch deluser -h
usage: gitswitch deluser [-h] USERNAME [USERNAME ...]

positional arguments:
  USERNAME

options:
  -h, --help  show this help message and exit
$ gitswitch deluser user2 user5
$ gitswitch deluser user1

-----------------------------------------------------

➤ ToDo:

  • ...

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

pyGitSwitch-0.3.0.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyGitSwitch-0.3.0-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file pyGitSwitch-0.3.0.tar.gz.

File metadata

  • Download URL: pyGitSwitch-0.3.0.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for pyGitSwitch-0.3.0.tar.gz
Algorithm Hash digest
SHA256 cb96aabca9dddec6aa2f8299314b49da18e99375f8a15a1d841460f0df076310
MD5 ee4735aeb5a7a45cd804c18e743d4717
BLAKE2b-256 33d4c70d4d6b922ed634f7760e6db5c0742f9b3331ed89a5beda8eb0c64a6116

See more details on using hashes here.

File details

Details for the file pyGitSwitch-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: pyGitSwitch-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for pyGitSwitch-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7a8af0e18c68554891ec910b743c4fd8995c6ab2a0e02fd7f66af62391606993
MD5 8815c8a65763cfc60286ebad5f061f7b
BLAKE2b-256 b53edaeb3be7e5083a0e21b984a7f7839a64780ffd0a49d2079e2e4842fddef2

See more details on using hashes here.

Supported by

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