-
-
Save chandrahasan1/9cfbdc49c79b3664b329 to your computer and use it in GitHub Desktop.
Revisions
-
rosswd revised this gist
Feb 4, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ ## Using new dual setup *This guide assumes you have followed `multi-git.md` and set up both accounts.* ### Github (default) Create a repo online called testmulti (or one of your choosing), then in Terminal, -
rosswd revised this gist
Feb 4, 2015 . 2 changed files with 86 additions and 83 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -32,9 +32,9 @@ Paste into text area, under ssh settings, in your github or bitbucket account. Also give the ssh key a title like "your name" Laptop. ## Create Config file I am using vim, enter your editor here if different: `vim ~/.ssh/config` Create your git aliases like so: @@ -71,84 +71,3 @@ Check keys were added: ssh -T gh ssh -T bb ``` This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,84 @@ ## Using new dual setup *This guide assumes you have followed `multi-git.md` and set up both accounts. ### Github (default) Create a repo online called testmulti (or one of your choosing), then in Terminal, create your repository: ```shell mkdir ~/testmulti cd ~/testmulti touch readme.md git init git add . git commit -am "first commit" git remote add origin git@gh:username/testmulti.git git push origin master ``` Add some text to readme on github.com, then: ```shell git fetch origin master git diff master origin/master git merge origin/master git push origin master ``` ### Bitbucket (secondary) Create a repo online called testbucket and then in Terminal: ```shell mkdir ~/testbucket cd ~/testbucket touch readme.md git init ``` *This being the secondary account, the username and email have to be overwritten, using secondary account values, at the repo level:* ```shell git config user.name "Full Name" git config user.email email_address ``` This must be done **once** for every *bitbucket* (or secondary) repo, it is not needed for github (or primary) repos because **the global is used** in that scenario. There may be a cleaner way to do this but right now it works okay. Just to be clear you do not need to change these values back afterwards because the global values (which apply to all future repos created) will be set. ```shell git add . git commit -am "first commit" git remote add origin git@bb:username/testbucket.git git push origin master ``` Add some text to readme on bitbucket.org, then: ```shell git fetch origin master git diff master origin/master git merge origin/master git push origin master ``` ## Use case: Repo already exists on secondary remote repo (bitbucket) So you have a repository that already exists and you want to want to `clone` it but also you want to make sure when you `push` it, the correct user, the bitbucket user pushes. Let's say the repo is called `booker`. ```shell git clone git@bb:bb_username/booker.git git config user.name "bitbucket user name" git config user.email email_address ``` Remember, because we are using the secondary account, we have to over-ride the global configuration of username and email. The git clone command is using the ssh keyfile you set up earlier and is doing the transfer over ssh. Now, change into the cloned directory and modify one of the files. Use `git status` to check the current state, then use `git add 'filename'` and `git commit -m "commit message"`. Finally push your changes using `git push origin master`. -
rosswd revised this gist
Oct 24, 2014 . 2 changed files with 6 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -26,10 +26,10 @@ pbcopy < ~/.ssh/id_rsa.pub pbcopy < ~/.ssh/id_rsa_bb.pub ``` Obviously run each `pbcopy` command **individually.** Paste into text area, under ssh settings, in your github or bitbucket account. Also give the ssh key a title like "your name" Laptop. ## Create Config file I am using macvim, alias mvim, enter your editor here if different: @@ -85,7 +85,7 @@ touch readme.md git init git add . git commit -am "first commit" git remote add origin git@gh:username/testmulti.git git push origin master ``` @@ -98,10 +98,6 @@ git merge origin/master git push origin master ``` ### Bitbucket (secondary) Create a repo online called testbucket and then in Terminal: @@ -127,7 +123,7 @@ There may be a cleaner way to do this but right now it works okay. ```shell git add . git commit -am "first commit" git remote add origin git@bb:username/testbucket.git git push origin master ``` This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,7 @@ # Setting up a seperate Github and Bitbucket account *NOTE: THIS GUIDE WORKS AS OF JAN 9 2014.* If you want to have private repositories at Bitbucket and public repositories at Github, then this is the guide for you. -
rosswd revised this gist
Jan 9, 2014 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,7 @@ # Setting up a seperate Github and Bitbucket account If you want to have private repositories at Bitbucket and public repositories at Github, then this is the guide for you. This guide assumes: -
rosswd revised this gist
Dec 17, 2013 . 1 changed file with 27 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,17 +3,20 @@ Github will be the main account and bitbucket the secondary. ## Create SSH Keys `ssh-keygen -t rsa -C "github email"` Enter passphrase when prompted. If you see an option to save the passphrase in your keychain, **do it** for an easier life. Save keys to: `~/.ssh/id_rsa` Repeat for bitbucket: `ssh-keygen -t rsa -C "bitbucket email"` Save bitbucket key to `~/.ssh/id_rsa_bb` ## Attach Keys Login to remote repo and add ssh key: @@ -23,14 +26,18 @@ pbcopy < ~/.ssh/id_rsa.pub pbcopy < ~/.ssh/id_rsa_bb.pub ``` *Obviously run each `pbcopy` command individually.* Paste into text area, under ssh settings, in your github or bitbucket account. Also give the ssh key a title like Ross' Laptop. ## Create Config file I am using macvim, alias mvim, enter your editor here if different: `mvim ~/.ssh/config` Create your git aliases like so: ```vim #Github (default) Host gh @@ -45,14 +52,14 @@ I am using macvim, alias mvim, enter your editor here if different: IdentityFile ~/.ssh/id_rsa_bb ``` ## Add the identities to SSH: ```shell ssh-add ~/.ssh/id_rsa ssh-add ~/.ssh/id_rsa_bb ``` Enter passphrase if prompted. Check keys were added: @@ -68,7 +75,8 @@ ssh -T bb ## Test repositories ### Github (default) Create a repo online called testmulti (or one of your choosing), then in Terminal, create your repository: ```shell mkdir ~/testmulti @@ -90,10 +98,12 @@ git merge origin/master git push origin master ``` If your puzzled why I didn't just do a `git pull` above, it's because I like to compare before I merge. I have had quite a few disasters doing a straight pull and thinking it will merge perfectly, don't do it. ### Bitbucket (secondary) Create a repo online called testbucket and then in Terminal: ```shell mkdir ~/testbucket @@ -110,7 +120,9 @@ git config user.name "Full Name" git config user.email email_address ``` This must be done **once** for every *bitbucket* (or secondary) repo, it is not needed for github (or primary) repos because the global is used in that scenario. There may be a cleaner way to do this but right now it works okay. ```shell git add . @@ -129,7 +141,9 @@ git push origin master ``` ## Use case: Repo already exists on secondary remote repo (bitbucket) So you have a repository that already exists and you want to want to `clone` it but also you want to make sure when you `push` it, the correct user, the bitbucket user pushes. Let's say the repo is called `booker`. ```shell git clone git@bb:bb_username/booker.git -
rosswd revised this gist
Dec 17, 2013 . 2 changed files with 10 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,8 @@ Github will be the main account and bitbucket the secondary. ssh-keygen -t rsa -C "github email" ssh-keygen -t rsa -C "bitbucket email" ``` Enter passphrase when prompted. If you see an option to save the passphrase in your keychain, **do it** for an easier life. Save keys to: This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,12 @@ # Setting up a seperate Github and Bitbucket account If you want to have private repositories at Bitbucket and public repositories at Github, then this is the guide for you. Your life is obviously simpler if you can afford Github but I cannot afford it and so this guide was created. This guide assumes: + Git is set up for a single github user using https, not ssh + There is only a *known_hosts* file in `~/.ssh/` + The computer is running Mac OSX 10.7 or greater + You already have an account at [Github](http://www.github.com) and another at [Bitbucket](http://bitbucket.org) -
rosswd revised this gist
Dec 16, 2013 . 1 changed file with 14 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -127,3 +127,17 @@ git merge origin/master git push origin master ``` ## Use case: Repo already exists on secondary remote repo (bitbucket) So you have a repository that already exists and you want to want to `clone` it but also you want to make sure when you `push` it, the correct user, the bitbucket user pushes. Let's say the repo is called `booker`. ```shell git clone git@bb:bb_username/booker.git git config user.name "bitbucket user name" git config user.email email_address ``` Remember, because we are using the secondary account, we have to over-ride the global configuration of username and email. The git clone command is using the ssh keyfile you set up earlier and is doing the transfer over ssh. Now, change into the cloned directory and modify one of the files. Use `git status` to check the current state, then use `git add 'filename'` and `git commit -m "commit message"`. Finally push your changes using `git push origin master`. -
rosswd revised this gist
Dec 16, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -106,7 +106,7 @@ overwritten, using secondary account values, at the repo level:* ```shell git config user.name "Full Name" git config user.email email_address ``` This must be done **once** for every *bitbucket* (or secondary) repo, it is not needed for github (or primary) repos because the global is used in that scenario. There may be a cleaner way to do this but right now it works okay. -
rosswd revised this gist
Dec 15, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ # Setting up a seperate Github and Bitbucket account This guide assumes: + git is set up for a single github user using https, not ssh -
rosswd revised this gist
Dec 15, 2013 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -109,9 +109,7 @@ git config user.name "Full Name" git config user.email "email" ``` This must be done **once** for every *bitbucket* (or secondary) repo, it is not needed for github (or primary) repos because the global is used in that scenario. There may be a cleaner way to do this but right now it works okay. ```shell git add . -
rosswd revised this gist
Dec 5, 2013 . 2 changed files with 5 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -89,6 +89,8 @@ git merge origin/master git push origin master ``` If your puzzled why I didn't just do a `git pull` above, it's because I like to compare before I merge. ### Bitbucket (secondary) Create a repo online called testbucket This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # Setting up a seperate Github and a bitbucket account This guide assumes: + git is set up for a single github user using https, not ssh + There is only a *known_hosts* file in `~/.ssh/` + The computer is running Mac OSX 10.7 or greater -
rosswd revised this gist
Dec 1, 2013 . 1 changed file with 8 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ # Setting up github and bitbucket on the same computer Github will be the main account and bitbucket the secondary. ## Create SSH Keys ```shell ssh-keygen -t rsa -C "github email" @@ -14,7 +14,7 @@ Save keys to: `~/.ssh/id_rsa` `~/.ssh/id_rsa_bb` ## Attach Keys Login to remote repo and add ssh key: ```shell @@ -25,7 +25,7 @@ pbcopy < ~/.ssh/id_rsa_bb.pub Paste into text area under ssh settings in your github or bitbucket account. Also give the ssh key a title like Ross' Laptop. ## Create Config file I am using macvim, alias mvim, enter your editor here if different: `mvim ~/.ssh/config` @@ -44,7 +44,7 @@ I am using macvim, alias mvim, enter your editor here if different: IdentityFile ~/.ssh/id_rsa_bb ``` ## Add the identity to SSH: ```shell ssh-add ~/.ssh/id_rsa @@ -57,16 +57,16 @@ Check keys were added: `ssh-add -l` ## Check that repo recognizes keys: ```shell ssh -T gh ssh -T bb ``` ## Test repositories ### Github (default) Create a repo online called testmulti ```shell @@ -89,7 +89,7 @@ git merge origin/master git push origin master ``` ### Bitbucket (secondary) Create a repo online called testbucket ```shell -
rosswd revised this gist
Dec 1, 2013 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ # Setting up github and bitbucket on the same computer Github will be the main account and bitbucket the secondary. 1. Create SSH Keys ```shell ssh-keygen -t rsa -C "github email" @@ -14,7 +14,7 @@ Save keys to: `~/.ssh/id_rsa` `~/.ssh/id_rsa_bb` 2. Attach Keys Login to remote repo and add ssh key: ```shell @@ -25,7 +25,7 @@ pbcopy < ~/.ssh/id_rsa_bb.pub Paste into text area under ssh settings in your github or bitbucket account. Also give the ssh key a title like Ross' Laptop. 3. Create Config file I am using macvim, alias mvim, enter your editor here if different: `mvim ~/.ssh/config` @@ -44,7 +44,7 @@ I am using macvim, alias mvim, enter your editor here if different: IdentityFile ~/.ssh/id_rsa_bb ``` 4. Add the identity to SSH: ```shell ssh-add ~/.ssh/id_rsa @@ -57,14 +57,14 @@ Check keys were added: `ssh-add -l` 5. Check that repo recognizes keys: ```shell ssh -T gh ssh -T bb ``` 6. Test repositories ## Github (default) Create a repo online called testmulti -
rosswd revised this gist
Dec 1, 2013 . 1 changed file with 10 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,10 +9,10 @@ ssh-keygen -t rsa -C "bitbucket email" ``` Enter passphrase when prompted. Save keys to: `~/.ssh/id_rsa` `~/.ssh/id_rsa_bb` 2. Attach Keys Login to remote repo and add ssh key: @@ -23,7 +23,7 @@ pbcopy < ~/.ssh/id_rsa_bb.pub ``` Paste into text area under ssh settings in your github or bitbucket account. Also give the ssh key a title like Ross' Laptop. 3. Create Config file I am using macvim, alias mvim, enter your editor here if different: @@ -42,7 +42,7 @@ I am using macvim, alias mvim, enter your editor here if different: HostName bitbucket.org User git IdentityFile ~/.ssh/id_rsa_bb ``` 4. Add the identity to SSH: @@ -55,14 +55,14 @@ Enter passphrase when prompted. Check keys were added: `ssh-add -l` 5. Check that repo recognizes keys: ```shell ssh -T gh ssh -T bb ``` 6. Test repositories @@ -109,15 +109,16 @@ git config user.email "email" This must be done **once** for every *bitbucket* repo, it is not needed for github repos because the global is used in that scenario. There may be a cleaner way to do this but right now it works ok. ```shell git add . git commit -am "first commit" git remote add origin git@bb:rosswd/testbucket.git git push origin master ``` Add some text to readme on bitbucket.org, then: ```shell git fetch origin master -
rosswd created this gist
Dec 1, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,128 @@ # Setting up github and bitbucket on the same computer Github will be the main account and bitbucket the secondary. 1. Create SSH Keys ```shell ssh-keygen -t rsa -C "github email" ssh-keygen -t rsa -C "bitbucket email" ``` Enter passphrase when prompted. Save keys to: `~/.ssh/id_rsa` `~/.ssh/id_rsa_bb` 2. Attach Keys Login to remote repo and add ssh key: ```shell pbcopy < ~/.ssh/id_rsa.pub pbcopy < ~/.ssh/id_rsa_bb.pub ``` Paste into text area under ssh settings in your github or bitbucket account. Also give the ssh key a title like Ross' Laptop. 3. Create Config file I am using macvim, alias mvim, enter your editor here if different: `mvim ~/.ssh/config` ```vim #Github (default) Host gh HostName github.com User git IdentityFile ~/.ssh/id_rsa #Bitbucket (secondary) Host bb HostName bitbucket.org User git IdentityFile ~/.ssh/id_rsa_bb ``` 4. Add the identity to SSH: ```shell ssh-add ~/.ssh/id_rsa ssh-add ~/.ssh/id_rsa_bb ``` Enter passphrase when prompted. Check keys were added: `ssh-add -l` 5. Check that repo recognizes keys: ```shell ssh -T gh ssh -T bb ``` 6. Test repositories ## Github (default) Create a repo online called testmulti ```shell mkdir ~/testmulti cd ~/testmulti touch readme.md git init git add . git commit -am "first commit" git remote add origin git@gh:rosswd/testmulti.git git push origin master ``` Add some text to readme on github.com, then: ```shell git fetch origin master git diff master origin/master git merge origin/master git push origin master ``` ## Bitbucket (secondary) Create a repo online called testbucket ```shell mkdir ~/testbucket cd ~/testbucket touch readme.md git init ``` *This being the secondary account, the username and email have to be overwritten, using secondary account values, at the repo level:* ```shell git config user.name "Full Name" git config user.email "email" ``` This must be done **once** for every *bitbucket* repo, it is not needed for github repos because the global is used in that scenario. There may be a cleaner way to do this but right now it works ok. ```shell git add . git commit -am "first commit" git remote add origin git@bb:rosswd/testbucket.git git push origin master Add some text to readme on bitbucket.org, then: ```shell git fetch origin master git diff master origin/master git merge origin/master git push origin master ``` This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ # Setting up a seperate Github and a bitbucket account This guide assumes: + git is set up for a github user using https, not ssh + There is only a *known_hosts* files in `~/.ssh/` + The computer is running Mac OS 10