How to use GIT commands with Bitbucket repository

How to use GIT commands with Bitbucket repository

In this tutorial we will show the steps to take to use the GIT commands to clone files from your hosting in a repository created in Bitbucket with the SSH of their cdmon hosting.


First of all, you need to have a repository created in Bitbucket. If you do not yet have it, you can access this step-by-step guide How to clone a repository and connect it to your cdmon hosting.


If you do not have any cloned repository to your ssh folder on your hosting, you will not be able to use any of these commands.


To display the commands as an example, we will create a text file and make changes with it. We will enter the folder assigned to our Bitbucket repository and launch the following command:



With this example file in the repository folder we can already show the different commands we can make to reflect changes to Bitbucket and vice versa.

GIT Commands

Mainly, there are 4 GIT commands with different uses:


git status: This command tells you the progress of the project compared to the repository in Bitbucket. For example, if you access the repository folder and run the "git status" you will see that the terminal shows a message similar to this:



The message indicates that the file is not tracked, which means that Git sees a file that does not belong to a previous confirmation. The state result also shows you the next step to follow: add the file.

git add: This command moves changes from the working directory to the Git test environment. The test environment is where you prepare a snapshot of a set of changes before confirming them in the official history.

Git should be instructed to track your new .txt file using the git add command. The git add command does not return anything when you enter it correctly.


If we do git status again, you can see that the file that you can confirm when you deem appropriate.



git commit -m: The git commit command confirms the snapshot prepared in the project history. In combination with "git add", the command we mentioned in the previous step, this process defines the basic workflow of all Git users.

This command is used to make the final confirmation. The "git commit -m" command must be entered with a confirmation message. We have executed "git commit -m Confirmation" as we show below:


At the time you first use the git commit command, the terminal will display a message like the one that appears to us on screen:



Basically, it indicates that you need to set up a name and an email address in order to apply that action. You must only copy the commands that the same message shows you and you must execute them with your respective information.

Once you have already executed both commands, you can re-release the previous command, i.e. the git commit -m with its respective confirmation message and now it must be executed correctly:


git push: To end from the terminal, we must send the confirmed changes to Bitbucket. To do this, we will use the git push command.

Once you press the Enter button again to run the command and the terminal will ask you again for the security key it has generated at the start.

We hope a little bit for you to carry out the process and you should tell us that it has ended smoothly.


To verify that it has been uploaded correctly, we are now going back to the Bitbucket dashboard, in the general configuration of the repository in question, and if we are going to the author of the request. with that of the test we have just done.


Move files created in Bitbucket to reflect in cdmon hosting

To end the tutorial, we will now show how to incorporate changes to your Git repository to see them. First of all, we will create a file in Bitbucket as a test reflected in the SSH folder of your hosting.

To add a new file, click Source to open the source directory, and then click the "More Options" button in the upper-right corner and select Add file from the menu. The More Options button only appears after adding at least one file to the repository:


A page will open for the creation of the new file. We will call it "BIT file". You must select in Syntax Mode the type of file you want to create with your respective code and give Commit to save the changes:



The Confirmation Message field appears with the default message. It can be edited if you wish or put the confirmation message you prefer.



With these steps we already have a new file in Bitbucket, now let's see how to extract these changes from the repository of our SSH.

The process is quite simple. Basically, it is about doing the procedure contrary to the shipment we did in the previous steps.

Open your terminal window and navigate to the repository directory level. In our case it is/test:


Once it is already inside the repository folder, the command you must launch is git pull -all.

The git pull command fuses your remote repository (Bitbucket) file into your local repository using a single command.

As soon as the "git pull -all" command will ask for the SSH Key password again, we put the one we have generated again:


It will take a few seconds to detect the new file, but it will finally indicate the number of files affected.

Finally, if we do a ls - we will see it that the file that has been created in Bitbucket is created in the hosting repository smoothly.


With all these steps we will have already created a repository in Bitbucket and merged it with ssh access to hosting


For more information, you can contact us.
    • Related Articles

    • How to create a GIT repository

      Here's step-by-step how to create and manage a GIT repository from your dashboard. This process is simple and straightforward, allowing you to set up a development environment quickly. Access to hosting Developer hosting Activate developer hosting ...
    • How to deploy GIT repositories

      Our GIT deployment tool allows you to clone and manage GitHub repositories directly from the cdmon dashboard, without using FTP or GIT commands. This makes it easy to install and update projects quickly and easily. To manage GIT repository ...
    • How to use the cdmon cache tool

      Server cache is a key tool for improving the speed and efficiency of your website. In essence, it works by storing copies of your site's pages and resources in a quick access location, reducing the need to load them from scratch whenever someone ...
    • Basic SSH Manual

      Buy Web Domain and SSL certificates With SSH access, you can work with your files and directories securely, and with connection from an application or command interpreter. Here is an example of a command interpreter for each of the most used ...
    • How to turn mialias.net on or off

      Buy hosting and domain The mialias.net is a temporary subdomain that is created when a new web hosting is registered in cdmon. It is used to work with hosting while IPs assigned to the domain have not spread. Once the domain is already aimed at ...