Getting started with Git and Bitbucket Server
There are 4 levels of user authentication:
- System Administrator — can access all the configuration settings of the Bitbucket Server instance.
- Administrator — same as System Admins, but they can't modify file paths or the Bitbucket Server instance settings.
- Project Creator — can create, modify and delete projects.
- Bitbucket Server User — active users who can access Bitbucket Server.
See Users and groups for more information about authentication.
See External user directories if you have existing user identities you wish to use with Bitbucket Server.
Create your first project and share it with collaborators
Create your project
The next thing you do in Bitbucket Server is to create a project. You'll add repositories to this project later.
Go to 'Projects' and click Create project. Complete the form and submit it to create your new project. See Creating projects for more information.
Open project access to others
If you are a project administrator, you can grant project permissions to other collaborators.
Click Settings then Permissions for the project:
The 'Project permissions' page allows you to add users and groups to a project you've already created.
There are 3 levels of project access:
- Admin — can create, edit and delete repositories and projects, and configure permissions for projects.
- Write— can push to and pull from all the repositories in the project.
- Read — can only browse code and comments in, and pull from, the repositories in the project.
See Using project permissions for more information.
Create a repository and get your code into Bitbucket Server
Create a repository
If you are a project administrator, you can create repositories in the project.
Once a repository is created, the project permissions are applied to the repository. That means all repositories created in a project share the same access and permission settings. If you already have a Git project you'd like to use, see Importing code from an existing project.
Click Create repository to open the repository creation form:
Once submitted you will be taken directly to your repository homepage. As there is no content in your repository yet, you'll see some instructions to help you push code to your repository. See Creating repositories for more information.
Clone and push
In a terminal, run the following command (replace
<bitbucketURL> with the URL for your instance of Bitbucket Server):
git clone <bitbucketURL>/git/<projectname>/<reponame>.git
Use your Bitbucket Server username and password.
The result in your terminal should be similar to what you can see in the screenshot below.
You should now have a new empty directory tracked by Git, in the user space of your local machine. Let's add some content and push it back to Bitbucket Server.
In your <reponame> directory, create a text file named helloworld.txt and write "Hello World" in it.
Now run the following command in your terminal
cd <reponame> git add . git commit -m "My first commit" git push origin master
If everything went fine, when you refresh the Bitbucket Server screen, you will see that the homepage of your repository has been replaced with a file browser showing you a link to helloworld.txt.
There you go, you're ready to get coding with your collaborators.
For more information about getting your code into Bitbucket Server, see Importing code from an existing project.
Check out our basic Git commands that you will probably use often.