How do I create/clone a bare repository in SourceTree?

I'm new to git, having used other (non-distributed) version control systems in the past. I'm looking to move my department to git, but need an easy-to-use tool for the majority of the team that has no experience in version control. There will be some advanced users, but probably a majority of the team needs a way to version control/backup their work with minimal fuss (and I'd like to stay on a single platform). I like the idea of SourceTree because it is a standalone application (no potentially confusing Explorer extensions for Windows).

So, to the point - I'm going through various tools (and version control systems) to figure out which ones are powerful enough for the advanced users, while simple enough for those less inclined. Step 1 is simply setting up the initial repositories... for DVCS, that would be the local repo and a central repo on a server. Due to company IT infrastructure, the central repo will simply be hosted on a network drive on a server (no SSH/http). Setting up the local repo seems straightforward enough (It looks like it might be a little intimidating for some of our users, but I think I can manage to train them on that part.) But even I can't figure out how to set up the remote repo using SourceTree. The git documentation I read says to do a

git clone --bare

But I don't see how to do that. I can't even create a new bare repo on the server that I could theoretically push to (or initially pull from).

Am I missing something?

2 answers

1 accepted

You can't create bare repositories in SourceTree, mostly because you normally only want to do this on a server and SourceTree is a client tool. Hosting your remote via a file share isn't a particularly robust way to do it and I'd recommend you consider either setting up a SSH server, using a cloud host which uses SSH/HTTPS, or alternatively consider something like Stash. If you definitely want to do it via file shares then you'll have to create the bare repo on the command line - for creating it's 'git init --bare PATH' rather than 'clone'.

Thanks for your quick reply.

It's too bad that you can't create a bare repository in SourceTree. Oftentimes we start development locally and then start version control. So it would've made sense for us to follow the process outlined in the Pro Git book at We could have a local repository, make a bare clone, and copy it to our server. But reading further, we'd probably also have to do another git init --bare in order for that to work, which SourceTree would also have to support.

As for file shares, that's the nature of our company's infrastructure. Engineering is a tiny piece of the company, and getting an ssh or http server running on our network is an expensive, painful process. And policy won't allow use to host on the cloud.

But thanks anyway!

You can also add --bare to a clone command on the command line. So it seems that it would be comparatively straight forward for SourceTree to add a Create Bare check box for the clone operation it offers. This would be one part of [Support for bare repositories|].

Or add a custom action?

Even though "SourceTree is a client tool" there is a strong reason for having support for local (not server) bare repositories.

It is common that one wants to share code between multiple projects.  The git-subtree commands are a great way of doing this that many consider to be superior to the older git submodules.  However, these require pushing to and pulling from a bare repository.

If one is going to be able to work productively offline (one of the main points of having a Distributed Version Control System), then one needs to be able to have a local copy of the bare repositories holding code that is shared between projects via subtree commands.  Later, when a network connection is available, one can synchronize the local copy with the remote server copy (e.g. at Bitbucket).

To be an excellent client tool, SourceTree should support the use of both subtree commands and local bare repositories that can be optionally synced with remote (e.g. Bitbucket) server copies when network access is available.

This need is also expressed in my comment in issue SRCTREE-69.

This is 3 years late but I wanted to make sure you understood that this very possible. Not sure why Steve says it's not possible. (You can't do it in Source Tree but it's very easy terminal commands)


You create your bare repo on your server or shared drive in your case with some simple commands in the terminal (which I'll let you google to keep this on topic). Source tree has a button to launch it at the top. Note:this is a third party application called MINGW32 that emulates a bash environment. But that's it, real simple git init --bash command. Just create it in a directory that will be secure.

Your central repo will just stay there. You never have to touch it again because the idea is that you're doing the push and pulls from your local repos.

Create your local repo in source tree. Then real easily add the remote repo by going repository->repository settings then Add.

Give it a name such as "origin" and the URL/path will be the path to your bare repo you created.

Alright, now you your local and remote repos are connected.

One special note. A bare repo doesn't look like a normal git repo. You won't see any of your working files in there. Don't ask me exactly why this is, it's just the way git is designed and has to do with the fact that a bare repo is not a working tree.

if you want other users to also push to that central repo, you can clone it to their local computer with source tree very easily. Just click the clone/new button and in the source path, enter the path to the bare repo and choose your destination path. Super simple.

now you can have many users pushing changes to the central repo.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 30, 2018 in Sourcetree

Tip from the team: configuring Git or Mercurial in Sourcetree

Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...

542 views 1 2
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you