Clone your repository and manage files locally
Tutorial: Work with Bitbucket Server
このページの内容
関連コンテンツ
- How Do I Generate/Extend a Bitbucket Server Trial or Evaluation License
- What is the Bitbucket Server ID?
- What is the Bitbucket Server ID?
- Install Bitbucket Server on Linux
- Install Bitbucket Server on Windows from a zip file
- Install Bitbucket Server on Linux from an archive file
- Moving to Bitbucket Data Center
- Install a Bitbucket Server trial
- Automated setup for Bitbucket Server
- Bitbucket Server upgrade guide
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
関連コンテンツ
- How Do I Generate/Extend a Bitbucket Server Trial or Evaluation License
- What is the Bitbucket Server ID?
- What is the Bitbucket Server ID?
- Install Bitbucket Server on Linux
- Install Bitbucket Server on Windows from a zip file
- Install Bitbucket Server on Linux from an archive file
- Moving to Bitbucket Data Center
- Install a Bitbucket Server trial
- Automated setup for Bitbucket Server
- Bitbucket Server upgrade guide