Wednesday, July 16, 2014

Bitbucket Linux Setup and Usage 5 min Tutorial

1. First you need to set up your git locally using the following command if you have not done so:

sudo apt-get install git
$which git (to see if it is installed)
git config --global user.name "FIRST_NAME LAST_NAME"
git config --global user.email "MY_NAME@example.com"

2. Then you need to create a git repository. If you already have it or you are joining someone else' repository, skip to step 3:

click create button at the top of the bit bucket page.

3. Clone your repository to local system:

mkdir /path/to/your/project
cd /path/to/your/project

git init      (initialize your repository locally)
git remote add origin https://xxxxxx@bitbucket.org/xxxxx/sgmstereoflow.git      (connect your repository with bitbucket)
git pull     (pull files from remote repository, if it is a new one you don't need to do that)

4. Every time you made a change or want to add some code,  do the following:

git add .    (add all local existing files)
git commit -m 'Initial commit with contributors'    (commit the change with a message)
git push -u origin master  (push the change back to the repository)

5. You can view the commit history, revert to a previous commit, modify readme, update wiki in bitbucket repositories.

No comments:

Post a Comment