Adding an Existing Project to GitHub or Bitbucket

Image is loading...

There are lots of hosting service providers for version control using Git like Github, Bitbucket, Gitlab, Sourceforge, Launchpad etc. But Here I am only explaining two of them. Github and Bitbucket.

GitHub Inc. is a web-based hosting service for version control using Git. It is mostly used for computer code. It offers all of the distributed version control and source code management (SCM) functionality of Git as well as adding its own features.

GitHub brings together the world’s largest community of developers to discover, share, and build better software. From open source projects to private team. But it is commonly used to host open-source software projects because the private repositories cost money.

Now coming to Bitbucket, it is also a web-based version control repository hosting service owned by Atlassian, for source code and development projects that use Git revision control systems.

The main advantage of Bitbucket over GitHub is, it offers free accounts with an unlimited number of private repositories (which can have up to five users in the case of free accounts). Bitbucket integrates with other Atlassian software like Jira, HipChat, Confluence, and Bamboo.

Where do I push my project?

  • If we need our project to be public or opensource, choose GitHub.
  • If our project to be private or limited to our team members, choose Bitbucket.

Note: GitHub support Private repositories but we have to pay for it. Also, Bitbucket supports Public repositories but GitHub is more popular and we get more attention from developers for an open-source project.



ADDING PROJECT TO GITHUB

I am going to explain the steps in adding a project to the remote repository on GitHub.

We need to register for an account in GitHub first. Then go the URL below.

https://github.com/new

Enter a repository name and description as in the snippet below.

Image is loading...

This will lead us to a page like below which contains the remote repository URL and all the commands to push our project to the repository we created.

Image is loading...

First, we have to initialize our project directory as a local repository by running the below command from the root directory of our project.

git init

Now add all the files and folders under our project directory to git.

git add .

We need to commit these change.

git commit -m "Initial commit"

After that, set the remote repository URL to the project directory(local repository).

git remote add origin [your_remote_repository_url]

Now push all files to the remote repository. The below command pushes our project to a master branch in our remote repository.

git push -u origin master




ADDING PROJECT TO BITBUCKET

After creating an account in Bitbucket, direct to the below URL to create a new remote repository.

https://bitbucket.org/repo/create

Image is loading...

This will lead us to a new page as below. From here we get the URL of our remote repository and instructions to push our project to it.

Image is loading...

First, we have to initialize our project directory as a local repository by running the below command from the root directory of our project.

git init

Now add all the files and folders under our project directory to git.

git add .

We need to commit these change.

git commit -m "Initial commit"

After that, set the remote repository URL to the project directory(local repository).

git remote add origin [your_remote_repository_url]

Now push all files to the remote repository. The below command pushes our project to a master branch in our remote repository.

git push -u origin master

About the Author: Syamlal CM

Hi, I'm Syamlal, the co-founder of Redmonark. I'm a developer, writer and also have a little bit of experience in graphic designing.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.