Coder Social home page Coder Social logo

githubaccswitcher's Introduction

GitHub Account Switcher

Placeholder Badge 1 Placeholder Badge 2

This script allows you to easily switch between different GitHub accounts on your local Mac (MacOS)

Table of Contents

Features

  • Allows switching between two different GitHub accounts.
  • Validates your GitHub credentials using HTTP response codes.
  • Prints user-friendly HTTP response messages.
  • Avoids unnecessary operations if you're already logged into the desired account.

Requirements

  • Bash 4.0 or later.
  • Git 2.0 or later.
  • cURL.
  • GitHub accounts with Personal Access Tokens.
  • Give chmod permissions to the script

Setup

  1. Clone this repository.
  2. Open the account_switcher.sh script in a text editor.
  3. Replace the placeholders with your GitHub usernames, Personal Access Tokens, and email addresses:
    • github_user1: Your GitHub username for account 1.
    • github_pat1: Your Personal Access Token for account 1.
    • github_email1: Your email address for account 1.
    • github_user2: Your GitHub username for account 2.
    • github_pat2: Your Personal Access Token for account 2.
    • github_email2: Your email address for account 2.

Usage

To run the script, use the following command in a terminal:

Permissions:

chmod +x account_switcher.sh

Execution

./account_switcher.sh

You'll be presented with options to choose between your two configured accounts. Enter your choice, and the script will switch to that account (or tell you if you're already using it).

Troubleshooting

  • If you receive a fatal: not in a git directory error, ensure you're running the script in a directory that's been initialized as a Git repository.
  • If the script fails to validate your GitHub credentials, check the HTTP response code and message for clues about the issue.

Contributing

We welcome contributions to this script. Please open an issue or submit a pull request on this repository to suggest changes or improvements.

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.