Bitbucket allows you to reliably track all changes and updates to your code base, merge requests from different teams, and easily roll back changes while making your repository available to your entire team.
Here's how to push to Bitbucket.
How to Create a New Repo in Bitbucket
Before you can push to a repository, you'll first create a new one.
Log in to Bitbucket, and then click the menu button in the top left. From the sidebar, click on the plus button, and select Repository.
Give the repository a name, and make sure the Version control system is Git. For the Include a README? option, switch to No.
Click Create repository to make a new repository.
How to Push to Bitbucket
Once a new repository is created, you'll be taken to a blank page with instructions to populate the repository. From this page, note the URL of your repository. It will be on the top text box (make sure to ignore the
git clone text when copying the link).
Now, you'll use the command line to upload files and push new changes to the repository. If you're using a Mac or Linux machine, open the Terminal. If you're on Windows, use Git Bash.
After opening the terminal, use the
cd command to navigate to the folder that you want to sync using the repository. Then, to start the Git process, use the following command:
Now, you'll sync the online repository with your local folder. In the following step, paste the link to the Bitbucket repository at the end of the command (make sure it ends with a
git remote add origin <repo link>
Next, stage the files for the syncing process by adding them to Git with the following command.
git add .
Then, to make sure that all files are added, check the Git status.
Before you start the remote sync process, you'll make the first commit. A commit is similar to adding a comment: When you look back at the code changes later, you can quickly recall what this particular update was about. Use the following command:
git commit -m "first commit"
Now it's time to finally push the folder contents to the remote repository at Bitbucket. Type the following command, and press
git push origin master
If you're doing this for the first time, you'll be asked to enter the password associated with the Bitbucket account that's linked to the repository. This is just a security measure to make sure that only the owner of the private repository can make changes to it.
Once the authentication is done, you'll see updates about the upload process. In a minute or two, the process will be done and you'll see a message saying so.
To check if the push process worked, you can open the Bitbucket repository in your browser. Instead of the empty page, you'll now see all your files and folders in the list.
If you want to track commits and see all changes, click on the menu button and select Commits.