Posts Tagged ‘github’

Copying a git repository from Cloudbees to Github

October 16, 2012 Leave a comment

I recently had to take my cloudbees hosted repository hosted on, well, cloudbees, and move it to github.  This was a bit tricky for someone will little knowledge of ssh and git (me), so hopefully if you’re in my situation this will help.  Note that this was done on a Mac OSX, should be similar for other unix based OS’s but probably slightly different for Windows.

I’ve used green color to represent terminal commands, so if you see something in green, it obviously needs to go into terminal…

First create a new account and repository on github.

Once you do that, you need to setup your ssh connection to git (you can also connect using http, but I’ll stick to SSH for now).  There’s a pretty good explanation by git-hub here, which I followed (well, some of it), but basically here’s what you need to do:

  1. Go to command terminal, and enter the following command which will copy your ssh public key to the clipboard
    pbcopy < ~/.ssh/
  2. If was not found, you need to generate a new ssh key locally, follow the git-hub tutorial mentioned above to do that.
  3. Go to your github account settings->ssh keys, and click “add SSH key”.  Give it a name and paste your key.
  4. In terminal, enter
    ssh-add -l
  5. This should give you a print of your key hash, make sure it is identical to what you see in your git-hub listing.  It should look like this:
  6. In terminal, go to your repository directory (e.g. ~/code/basicservice/)
  7. make sure you have a git repository there:
    git status
  8. Create a new repository on git-hub, don’t initialize it with README
  9. Push your repository to git-hub
    git push<youraccount>/<your-repository>.git master
    you can get the git url from your git repository page, make sure you click on SSH to get the right url, or just replace <youraccount>/<your-repository> with your data.
  10. That’s it.  Your repository is now hosted on git-hub as well, you can now drop the cloudbees repo and start using git-hub.  To make it push both to cloudbees and to github simultaneously (if you want to keep both) you need to add some configuration, and I’ll pass on that right now.  You can check out this post for help on that.
Categories: R&D Tags: , , , ,