Quick start guide using Git with Bitbucket

Git This is the very basic tutorial which will get someone like me who never used git before and will teach how to at least start doing the basic operations with git & using bitbucket repositories.

 

Upload Project to Bitbucket

If you already have the project stored locally just like I had you will first need to go through the following process.

-Install Git

-Create a Repository on bitbucketBitbucket Logo

-Goto the folder which you want to upload(In Git this is called Push) to bitbucket repository on your OS(Windows) right click and select Git Bash. It will open the Terminal

-On the Terminal Write:

$git init

-Next, add a remote called origin pointing at bitbucket.

$ git remote add origin https://you@bitbucket.org/you/repository_name.git

You can find the above information on the Bitbucket Repository Page, Get Started Tab.

-Create a notepad file xyz.txt in the folder.

-On the Term do

$git add --all
$git status

Above should show something like below:
# On branch master
#
# Initial commit
#
# Changes to be committed:
# (use "git rm --cached ..." to unstage)
#
# new file: xyz.txt
#

-Set Global Username & Email for the Git

$git config --global user.name "Your Name"
$git config --global user.email you@example.com

-Performing First Commit

$git commit -m "Importing my code" -a

The code has not been Pushed to the repository, however it has been saved locally

-To Push the Commit

$git push -u origin master

Anytime a change is made follow add, commit, push!

 

Download Project from Bitbucket

If you have sucessfully pushed the code/project to the bitbucket repository and now you would like to use the same code on different systems or share it between the group.

-Install Git

-Create directory where the code will be pull/downloaded

-Goto the folder ,right-click and select Git Bash. It will open the Terminal.

-On the Terminal Write:

$git init

-Next, add a remote called origin pointing at bitbucket.

$ git remote add origin https://you@bitbucket.org/you/repository_name.git

-Set Global Username & Email for the Git

$git config --global user.name "Your Name"
$git config --global user.email you@example.com

-Download/Pull from git

$git pull origin master

Now follow the same procedure explained above add,commit,push!

Etc.. |