Giter Club home page Giter Club logo

git-ssh-bash-scripts's Introduction

About This Repository

Have you ever tried to use multiple repositories from the same vendor (GitHub, BitBucket, GitLab, ...) but with different SSH keys? Well, that's not easy.

Indeed, your SSH agent will probably only support automatically one key per domain. However, you can assign specific keys to each repository with adequate git configuration settings (core.sshCommand).

This repository contains a collection of shell scripts to facilitate git repositories management with multiple SSH keys.

Scripts

Most scripts will guide you through the process.

Add All SSH Keys to the Agent

In case your agent loses track of some of your keys, you can all them all at once with this script. Keys must be stored in ~/.ssh (which is the default SSH folder).

Usage:

ssh-add-all-keys.sh

Cloning a Repository

Clones a repository and assigns a SSH key to it. The specified repository will be cloned in a sub-folder.

Usage:

gcssh <git_ssh_uri>

Adding a New Remote to an Existing Repsitory

Adds a new remote to an existing repository and assign a specific SSH key to it. You must execute this script from the folder of the repository. Useful if the git repository has been initialized locally and not cloned.

Usage:

garssh <git_remote_ssh_uri>

Adding a Submodule to an Existing Repository

Adds a submodule to an existing repository and assign a specific SSH to it. You must execute this script for the folder of the repository.

Usage:

gasmssh <git_submodule_ssh_uri>

Initializing Submodules for an Existing Repository

In some cases, submodules must be initialized with the SSH key of the repository. This script is designed for that. You must execute this script for the folder of the repository.

Usage:

gismssh

Assign a SSH key to an Existing Repository

This script sets the SSH key to use for a repository. You must execute this script for the folder of the repository.

Usage:

gsetsshcfg

git-ssh-bash-scripts's People

Contributors

chsxf avatar

Watchers

 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.