Search This Blog

Friday, October 4, 2013

Git clone - use different keys for different repositories / user another private key

To clone git repository with a different private key than your /home/user/.ssh/id_rsa


  1. Create a script called: git_ssh_wrapper.sh
  2. Give the script executable permissions:

    chmod 777 git_ssh_wrapper.sh
  3. The contents of the script should look like the following:

    #!/bin/bash
    ssh -i /home/user/RSA_Keys/id_rsa $1 $2

  4. Export variable GIT_SSH:
    export GIT_SSH=~/git_ssh_wrapper.sh
  5. Clone the repository as usual:

    git clone user@server.com/repository.git

No comments:

Post a Comment

If you like this post, please leave a comment :)