A repository Bitbucket is where all of your files are stored and a history of all the changes you’ve made to those files are stored as well they’re fundamental to any project that you’re going to work on and it’s really important that you understand how to use them and work with them today my name is Kelvin I’m a product marketing manager for a Bit Bucket and I’m here to show you how to work with your repositories in Bit Bucket bucket bit bucket is a place to store manage and track all of your files on any project that you’re working on whether as an individual or as a team we’re going to follow a pretty common workflow to demonstrate how all of this works.
we’re gonna create a repository in bit bucket clone that repository to our local machine add a file to our local repository and commit those changes push those changes back up to our bit bucket repository and then we’re gonna add a file inside bit bucket and pull that file and those changes back to our local repository two things you’ll need a bit bucket account which you can sign up for and bit bucket at all and a basic understanding of the git commands will be using commands such as get push pull add and status.
so you should know your way around yet already let’s dive right in so the first thing we want to do is to create a repository in bit bucket to do that all you need to do is make sure you’re logged in and on the left-hand side here click the plus icon from here gives us a list of options we can create a repository team project snippet or even import a repository all we want to do here is create that repository and when we check out the new screen you’ll see a number of options for us that we can leverage when we’re creating the repository we can give it a name there’s an access level there whether it’s a private or a public repository whether or not we want to include a read me a version control system and if I toggle the ‘Advanced Settings’ here in add a description for the repository whether we allow forking use issue tracking or a wiki I can also select the language for this repository too for the time being though all we want to do is leave the defaults as is and just add a repose rename so we’re gonna call this landing pads will click the repository or create repository button at the bottom and you can see we are now taken to a new screen it’s an empty repository.
so it’s givings instructions and what to do next more importantly if I go back and click on the plus icon that we use to create the repository you can see gives us a number of different options here we can clone it create a branch create a pull request compare branches or tags or fork the repository so we’re now terminal we want to navigate to the directory where we want to clone our repository to once we’ve done that we can jump back into Bit Bucket and you can see we have a URL here that allows us to clone the repository to our local machine so just jumping back here copying and pasting the URL you can see we’ve cloned landing pads and it gives us a warning that we have an empty repository on our machine but of course we knew that already so I’m going to list the contents of the directory we created the repo in and you can see there that landing pads is now part of the directory on my local machine and that’s it we’ve cloned our repository from bitbucket and now it’s time to add some files to it with the repository cloned to our local machine it’s time to add a file so back in terminal we just want to navigate to the repository we just cloned and then what we want to do is we want to add a file with some content to it.
so I’m going to quickly add that-right now to a file called location start txt nothing happens when I press return and that’s a great thing what we’ll do here is type in or enter get status and it sure is here that we don’t have any commits but we do have an untracked file and that untracked file is the file we just created the git status command tells you how your project is tracking in comparison to your bitbucket repository git is aware that you created a new file but it’s on tracked and status output tells you what the next step to take is adding the file tell get to track your new file by using the git add command in terminal
bitbucket create repository
so type in git add and the name of the file that is on track and just like when you created the file when I press return the git add command doesn’t return anything this command moves changes from the working directory to the git staging area which gets you one step closer to committing it now you can check the status of the file with git status you can see the new file has been added and you can commit it when you’re ready the git status command displays the state of the working directory and the staging area now we want to commit the actual file into the repository itself and we do that by typing in git commit and I’ll commit message the git commit takes the changes in the staging area and commits it to the project history combined with git add this process defines the basic workflow for all git users up until this point everything you have done has been on your local machine and invisible to your bitbucket repository at least until you push those changes.
so now what we want to do is push those changes up to our BitBucket repository what we want to do is use the git push command to push this commit from our local machine up to bit bucket see a whole bunch of text on the screen to indicate our commits and now on the remote repository so let’s go back to our repository in bitbucket and see the file we just committed all I need to do here is just refresh my page and now we can see our file in our repository we can see the commits we’ve made as well in the left-hand navigation menu and when we click on our commit we take into a page with details of the commit where you can see the change we just made the file that we added and the actual content in that file as well so we’ve seen how we can creates file in our local repository commit it and then push those changes back up to our repository in bit bucket but we can also do the other way around we can add a file in bit bucket commit it to our repository there and then pull those changes back to our local machine.
bitbucket create repository command line
let’s do that now from the source page click the meatball button on the top right here and we want to add a file on this screen you can add a new file to a branch and name the file we’re creating we’re gonna leave everything as a default here and just give this a name we’re gonna enter in some text here and just at the bottom and there’s terms of a syntax we’re gonna select HTML and that’s done we click the commit button on the right comes up with a commit message we’ll leave that as a default and click commita gain and there you go we’ve created a file in our repository within bitbucket and we’re now taken to a page you might be familiar with with details of the changes that we’ve made and the commits that we just made as well and if we go back to the source you can see we now have two files that are associated with this repository.
how to create project in bit bucket
so we now have our newly created file in bitbucket and we want to pull that file to our local repository on our machine it’s a pretty straightforward process and is actually very similar to the push we used to get our file from our local repository up into bit bucket we navigate to the top of our local repository in terminal and enter in the git pull command I’m using the all command for this tutorial but it might not be appropriate for you to pull and merge all changes in more complex workflows when that’s done we list the contents of our repository and we can see the files we just added from bit bucket and that’s how to work with repositories in bitbucket we followed a pretty typical workflow to create and interact with repositories in bitbucket both inside the product and locally on our machine happy coding
Other Keywords: bitbucket, bitbucket login, bitbucket tutorial, what is bitbucket, bitbucket vs github, login bitbucket, bitbucket download, bitbucket.org login, bitbucket pricing, bitbucket server, how to use bitbucket, bitbucket commands, bitbucket delete repository, difference between git and bitbucket, bitbucket logo, bitbucket documentation, git vs bitbucket, how to push code to bitbucket, github vs bitbucket, atlassian bitbucket, bitbucket pipelines, atlassian bitbucket login, difference between github and bitbucket, how to delete repository in bitbucket, download bitbucket, bitbucket signup, git bitbucket, how to create branch in bitbucket, how to clone bitbucket repository, change bitbucket password, delete repository bitbucket, bitbucket repository, bitbucket account, how to clone from bit bucket, how to push project to bitbucket, sourcetree bit bucket download, create bit bucket account, difference between bit bucket and github, bit bucket change password, what is difference between bit bucket and xname, bit bucket tutorial pdf, install bit bucket on windows, gitlab vs bitbucket, how to change bit bucket password, bit bucket vs git, how to change commit author name in bit bucket, bit bucket wiki, bit bucket sourcetree, bit bucket move repository to another server, pull request in bit bucket
Here are some more FAQ related to this Article: