Git: Working with Bitbucket Remote Repository

Share At:

As a developer, you are required to push your codes quite often to a remote repository so that your team has access to it. Secondly, it is quite prudent to have all your codes in the remote server, just to avoid any disaster which may arise in case of your desktop/laptop failure. You won’t like to take the risk to lose all your codes, right?

In this article, we’ll be learning how to use bitbucket as your remote repository.

Bitbucket is quite similar to GitHub and you can say it’s a substitute for GitHub.

  1. Create bitbucket account:

Please go to the url: and click on “get it Free” if you are a first time user.

2. If you already have a bit bucket account, please press “Log In”.

3. In your Linux system, please create a ssh key pair as below:

You will see a pair of public and private keys:

[root@git ~]# cd .ssh
[root@git .ssh]# ls -l
total 8
-rw — — — -. 1 root root 1679 Dec 4 14:29 id_rsa
-rw-r — r — . 1 root root 403 Dec 4 14:29
[root@git .ssh]# cat
ssh-rsa AAAAB3NzN8ddMqxsgnJBfki7STVhvBftXUBBaX4OJyrNriCiqckpT0iU/fOKALSQuoR61tEZxpZKWVPdrC/jzmuyO1z2JjRbBX8HxoFwA5WeESlHmP5QZGU9mzFGDSkCkxpxt7LkaFWy6F1o9reTH+M3yeM3faaRMtrl/OoVOGbk8dTpvAA8ZM03KdGi88du3oiNHg+YIPZe6j4l6JOk81BwUkv4q++3aIZII7npjtqX/ET24LyO8CRuTH0OEY9huQ1g/18G2OqsQ1mu2o1Zv+MGZgpRHxABO00xVhTHhm5EDK2J0aqEiEOcI1e+gncBQOXR+fDq8BKJtYK4BASXWo3psQa2vwCJ80g90Qex+jj1bXzUwOMb
[root@git .ssh]#

4. Now go to your bit bucket account → Personal settings → ssh keys.

5. Now click on add key and paste the public key in the “key section” and press “add key”

6. Now we are going to create a repository. Click on the ‘+’ sign and click on “repository” under the create section:

7. Fill up required details and click “Create repository”. Ensure to give the same name as your local repository.

8. Now you will see the below details in the next screen. (clicking on the “source” tab will also give you the same details.

9. Now go to your server and go inside your repository directory and run the below commands:

[root@git infra-automation2]# git remote add origin

[root@git infra-automation2]# git remote -v

origin (fetch)

origin (push)

[root@git infra-automation2]#

10. Run “git push origin master” to push all your codes in your bitbucket remote repository called “Infra-automation2”.

11. Now go to your remote repository and refresh the page. You will see your codes there.

12. if you check carefully at your local repository, you will see there are 2 more files called “file.jpeg” and “file.mp4” that has not been copied inside the remote repository. why?

The reason is — since we have created a “.gitignore” file and have mentioned to ignore any files with .jpeg and .mp4 extension. This is wise too since adding media files to your remote repository for version control doesn’t make any sense !!

~~~Happy Learning !!

Share At:
0 0 votes
Article Rating
Notify of
Oldest Most Voted
Inline Feedbacks
View all comments
gate io borsası
18 days ago

At the beginning, I was still puzzled. Since I read your article, I have been very impressed. It has provided a lot of innovative ideas for my thesis related to Thank u. But I still have some doubts, can you help me? Thanks.

Code Binance
29 days ago

Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.

Back To Top

Contact Us