Skip to content

Instantly share code, notes, and snippets.

View vinaysudani's full-sized avatar

Vinay Sudani vinaysudani

View GitHub Profile
@dbirks
dbirks / migrate-git-repos.md
Last active September 11, 2023 06:05
Script to fully migrate git repos, including all tags and branches

Migrate git repos script

I used this for migrating git repos from Bitbucket to Github. It uses git's --mirror flag for cloning and pushing to also transfer all tags and branches.

It would be helpful to have SSH keys set up on both ends. Then all you should have to do is to make sure the hardcoded orgname is set to the appropriate one for both the source and destination.

Once I migrated repos, I used this to replace my origin url locally (assumes using ssh):

sed -i s/bitbucket.org:orgname/github.com:orgname/g .git/config
@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active May 7, 2024 12:29
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.