In this post I am going to describe how to put a project on bitbucket which exists on our local machine.
First of all bitbucket is a repository controlling site like github. But its free for private uses till 5 users. For all the first timer to this type of concept, it is used for developing a project with multiple team members. So that it can synchronize and can be controlled automatically.
Suppose you have a project folder with name of firstproject. You directly can't put it to bitbucket if you haven't made this a repository. I will explain it using terminal for linux( change the command if you are working on windows). It works same on mac.
STEP 1:
First we have to install hg-mercurial or git-mercurial plugin. You can download it from the below link according to your Operating System. It is plugin for maintaining repositories version and all the stuffs.
Download it and install it.
Check that it is installed ant path is set. Type hg and then enter on terminal if you see
Error : hg command not found.
Then set the path variable in .bashrc file. Open .bashrc in any text editor with root permission and add the path of the folder where you have installed hg. It by default install in /usr/local/bin folder.
Type :
export PATH=$PATH:/usr/local/bin
If you download hg-mercurial somewhere else then replace /usr/local/bin with your exact path.
STEP 2:
Go to the folder of your project using cd command on terminal. Like this.
cd /my/path/to/project
Type hg init for initialise repository or git init if you are using git-mercurial plugin.
STEP 3:
Type hg add for adding all files which you have or git add.
STEP 4:
Now go to bitbucket.org and make an account. (free account is also available as of now)
Then create an empty repository by going on create and repository.
STEP 5:
Push your repository to bit bucket using hg push command format will be like.
hg push url_of_your_repository
NOTE: Replace url_of_your_repository with original url of your repository.
It will ask for setting username. Open .hgrc file in texteditor and set the
username= myusernamewhatever
for linux :- sudo gedit .hgrc
for mac : - open -e TextEdit .hgrc
It will ask for your password of bitbucket.
STEP 6:
For starting you can commit anything. Like
hg commit -m "myfirstinitialcommit"
I hope it helps. If you have any other doubt please comment below. Share if you find it is useful. Thanks and Enjoy.
No comments:
Post a Comment