Versions
- 9.5
- 9.4
- 9.3
- 9.2
- 9.1
- 9.0
- 8.19
- 8.18
- 8.17
- 8.16
- 8.15
- 8.14
- 8.13
- 8.12
- 8.11
- 8.10
- 8.9
- 8.8
- 8.7
- 8.6
- 8.5
- 8.4
- 8.3
- 8.2
- 8.1
- 8.0
- 7.21
- 7.20
- 7.18
- 7.19
- 7.17
- 7.16
- 7.15
- 7.14
- 7.13
- 7.12
- 7.11
- 7.10
- 7.9
- 7.8
- 7.7
- 7.6
- 7.5
- 7.4
- 7.3
- 7.2
- 7.1
- 7.0
- 6.10
- 6.9
- 6.8
- 6.7
- 6.6
- 6.5
- 6.4
- 6.3
- 6.2
- 6.1
- 6.0
- 5.16
- 5.15
- 5.14
- 5.13
- 5.12
- 5.11
- 5.10
- 5.9
- 5.8
- 5.7
- 5.6
- 5.5
- 5.4
- 5.3
- 5.2
- 5.1
- 5.0
- See all
Clone your repository and manage files locally
Tutorial: Work with Bitbucket Server
On this page
Related content
- No related content found
- Set up SourceTree to work with Bitbucket Server
- Create a personal repository in Bitbucket Server
- Clone your repository and manage files locally
- Commit and push changes to Bitbucket Server
In this step you will clone your personal repository to your local computer. Cloning your repository locally creates a file directory on your computer that will kept in synch with your online repository.
Making changes to live source files makes your website vulnerable to user errors. Since we all make mistakes, we instead clone the source files locally and make our changes on our own computer where we can first test that our changes won't break things in the process. Once we verify things are as they should be we then can push our changes to the live source files (usually a master branch). From there, others can pull in our changes to their local copy, and update files of the website.
- Clone your personal repository using SourceTree (or the command line)
- On the side navigation, click Clone, then Clone in SourceTree to create a local directory where you can store the website files.
This opens the Clone New dialog in SourceTree. - Within SourceTree, choose the appropriate destination for your personal repository, then click Clone.
You'll arrive at the empty directory in SourceTree, and an empty directory named website was created on your local computer.
- On the side navigation, click Clone, then Clone in SourceTree to create a local directory where you can store the website files.
- Download the source files and unzip them into the empty directory you just created.
- Add the files to your personal repository using SourceTree (or the command line).
- Select the files you added in the previous step by checking the box named Unstaged files.
The files then appear in the Staged files pane. - Click Commit, add a message in the comment box, and check the box Push changes immediately to origin/master.
- Go to your personal repository and verify the files were added.
- Select the files you added in the previous step by checking the box named Unstaged files.
Do it from the command line
Clone your personal repository from the command line. You can also copy the command directly from your empty repository. Look under Working with your repository.
From a terminal window, run these commandscd ~ git clone http://<username>@<Bitbucket Server URL>/scm/<project key>/website.git
Click for an explanation of these commands...cd ~
Change directory to your home directory git clone
Command that copies the contents of the repository <username>
Is the username you use to log in to the instance <Bitbucket Server URL>
The URL for your Bitbucket Server instance <project key>
The project key where your personal repository is website.git
The name of your personal repository This creates an empty Git repository named TISwebsite
Add the files to your personal repository from the command line.
From a terminal windowcd existing-project git init git add --all git commit -m "Initial Commit" git remote add origin http://<Bitbucket Server URL>/scm/tis/website.git git push -u origin master
Click for an explanation of these commands...cd existing-project
Change to the directory where you unzipped the files git init
Initialize the Git repository git add --all
Adds the files to the repository git commit -m "Initial Commit"
Adds a comment to the commit git remote add origin <url>
git push -u origin master
Adds the remote repository and pushes your files to the master branch
Related content
- No related content found