Wednesday, January 19, 2011

Using Bit Bucket

Following my friend's recommendation I decided to check out this site called Bit Bucket which is a free code sharing/hosting website where one can essentially store their code and any changes they make to that file. Following are the steps to get things up and running:
1. Install Mercurial (if you don't already have it)
2. Open an account with https://bitbucket.org
3. Create a repository on bitbucket.org. Let's call it bit_repo.
4. Create a /home/user/.hgrc file with the following lines on your desktop.
[ui]
; editor used to enter commit logs, etc. Most text editors will work.
editor = vi
username = firstname lastname
5. cd in to a directory on your desktop which contains codes that you want to backup.
5.1. Type> hg clone https://
bitbucket_user_id@bitbucket.org/bitbucket_user_id/bit_repo
destination directory: bit_repo
http authorization required
...
Then cd
bit_repo
6. To add a specific file to Bitbucket, type
hg add file1.c
hg commit -m "I commit to add this file to bitbucket" [The msg in quotes can by anything]
hg push https://bitbucket_user_id@bitbucket.org/bitbucket_user_id/bit_repo
7. To remove a file type
hg remove file2.c
hg commit -m "I commit to remove this file"
hg push https://bitbucket_user_id@bitbucket.org/bitbucket_user_id/bit_repo
8. To copy files/repositories from bitbucket, type
hg clone https://bitbucket_user_id@bitbucket.org/bitbucket_user_id/bit_repo
9. Here is a Bitbucket 101 http://confluence.atlassian.com/display/BITBUCKET/Bitbucket+101
10. To keep things safe I would just softlink files to their sources on my desktop.