How to add project to Github or BitBucket ?

How to add project to Github or BitBucket

How to add project to Github or BitBucket ?



So i want to upload my project to a repository. So that i can update it and develop it using repository (Version control). So let’s get started to get Version Control on this project. You can follow below given steps to add your project to github or BitBucket.





Create a account

You need to have a account either on Github. If you want to create repository in Github. Create account on Github here. Or you can create account in BitBucket for that go here. Once you have a account created you can follow further steps.



Create a Repository

Well this step is the main purpose of this guide so let’s create a repository,





You can create Public or Private repository. If you want to share your repository then create a public repository. Companies create Private repositories for their projects. So if your project is something you do not want to share check the private option (as shown in image). You can add readme file in your repository for reference of your project details.



Add project to repository

So we need to go to our local project using “Terminal” or “CMD”. You can do this





// CD stands for Change Directory
cd /path/to/your/project/folder

Initialize git using this command in your project



git init

In the image above i have a git clone command but some portion is hidden you will see something like this in your repository. But we need to run below given command to add our project to repository





git remote add origin https://yourAccountName@bitbucket.org/restOfUrl.git

Add all your files to version control using this command



// . is for adding all files
git add .

Now we need to commit and we can add a mesage to our first commit using below given command.





git commit -m "You message goes here"

Finally push code to the repository using this command



// master is branch where code will be pushed
git push -u origin master

You will be asked for password and account email for repository website Github or Bitbucket. Just enter and all should be good. You should be able to see your local project files in your repository.