Bitbucket is a git-based source code repository hosting service that allows users to track all changes and updates to your codebase, merge requests from different teams, and easily roll back changes. The software makes repositories available to the entire team. The tool offers both commercial plans and free accounts with an unlimited number of private repositories. Here is how you can create repositories in Bitbucket and push code to the repositories:
How to Create a New Repository in Bitbucket?
You need to create a new repository before you can push code to it. Log in to your Bitbucket account or sign up for an account if you don’t already have one. Go to the Repositories tab and click on the “Create repository” button.
Give the repository a name, and make sure the Version control system is Git. For the “Include a README?” option, switch to No. Then, click on the “Create repository” button to make a new repository.
Once the new repository has been created, you'll be taken to a blank page with instructions to populate the repository. Note the URL of your repository at the top of the page.
Now, you need to use the command line to upload files and push new changes to the repository. Open the terminal if you're using a Mac or Linux machine. If you're on Windows, you need to 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 need to sync the online repository with your local folder. Use the following command and paste the link to the Bitbucket repository at the end. You should make sure the command ends with a .git suffix:
git remote add origin <repository link>
Next, add them to Git with the following command:
Then, check the Git status using the following command:
Now, make the first commit before you can start the remote sync process. Commit is similar to comment and can help users easily recall what this particular update was about. You need to use the following command to make the first commit:
git commit –m “<commit name>”
Now, you need to push the contents of the folders to the repository using the following command:
git push origin master
You will also need to sign in to your Bitbucket (Atlassian) account if you’re doing this for the first time. This ensures that only authorized personnel can make changes to the repository. Once the authentication is done, you'll see updates about the upload process.
You can open the Bitbucket repository in your browser to check if the code files have been pushed to the repository.
Git can be a great application for developers that can assist them in version control. It can be critical in performing various tasks throughout an enterprise. Integrating the tool with various apps can assist in automating manual tasks for businesses and save them a lot of time.
Appy Pie Connect integrates Bitbucket with 150+ apps to automate work for businesses and increase productivity. Users can set up triggers for Bitbucket so that action can happen in another app and vice versa. Bitbucket offers both commercial plans and free accounts for users with an unlimited number of private repositories.