Introducing GitHub
In the last part of this series I warned that your local Git repository was not backed up anywhere. This is definitely a very bad situation.
In order to fix this you just need to create a copy/clone of your repository somewhere safe. You can do this by just copying your filesystem to at least one other drive. However this will all be local to you and private.
If you want to share your code with other developers you can always set up your own Git server and make it publicly accessible, but there is another option – GitHub . This is a sort of social networking version control central Git repository that lives in the cloud. There are many levels of accounts, with the most basic one being free and all your repositories being public. If you want to share your code with others this is an ideal place to put your code and have it backed up.
Integrating your Flash Builder project with GitHub is pretty simple if you have EGit installed as I showed in the last part of this series.
I will now explain how to do this.
Create an account on GitHub
I won’t explain this here as this is all explained on the site.
Create a new repository on GitHub
Even though we have already created our repository locally we will still be able to create a new repository on GitHub and push all of our content into it. So from your GitHub dashboard page clicke the ‘New Repository’ button. You will be taken to the following screen

Enter the details and click Create Repository
you will see this page

You don't need to do any of this, just click continue.
Setup Encryption Keys
GITHub uses encryption keys for accessing repositories. You need to make sure that Eclipse knows about your github private key – I hope you set one up when you created your account. So inside Eclipse click Windows>Preferences, search for ssh and click on the SSH2 option. Add your ssh keys here.

Push the new project to GitHub
We’re almost there. Right click on the project and select Team>Push To…

You then fill out the details of the repository. These are provided very clearly on the GitHub page for the repository. An important thing to note is that if you have a free account you can only put the username ‘git’ with no password here

click Next>. You now have a screen where you tell GIT which branches/tags of the project to push to GITHub

To tell the truth, at this point I am not completely clear as to what is happening, but if you click the ‘Add all branches spec’ and then Finish you see

Click OK and magically you have now pushed your repository to GITHub where it is backed up (and possibly publicly available).
UNFORTUNATELY
EGit is not perfect and after this initial push to GitHub both Eclipse and EGit forget what the remote repository is, and you have to fill in the same information over and over again. This is very annoying, but there is a simple command line fix. If you enter terminal, go to the directory where your project is (the one with the .git directory in it) and type the following command
git remote add origin git@github.com:piercer/GitProject.git
(making sure that you type in your repository URL and not mine) then the next time you do a ‘Push to…’ there is an extra entry at the top of the ‘Push To Another Repositories’ where the github repository is automatically selected for you and you don’t have to type in all the details again – very useful.
Conclusion
So you now have a local repository and a remote one on GitHub that are linked together.
In the final part of this series I will show you how to use Git in Flash Builder in your daily workflow.



Hey conrad, nice posts!
I have some questions regarding security issues I’m facing with one of the projects at http://clipyourphotos.com Is it possible to reach you by email?
Cheers.