how to open/view a shared (bare) git repository w/ SourceTree?

Am a noob to both Git and SourceTree.

We wish to use Git with shared repositories, created with:

mkdir shared_repo
cd shared_repo
git --bare init --shared
git --bare fetch myrepo master:master # import myrepo into shared_repo

then push/pull changes from shared_repo. ( Bare repos don't have a working tree, and so do not have a .git folder; all subfolders of the .git of a normal git repo are in main folder of repo init'd with --bare.)

But when I try to do a file | open on shared_repo in SourceTree, I get the msg "Invalid folder: the path ... does not refer to a working copy for Mercurial, Git or Subversion".

I can open and view shared_repo with gitk, and it appears to be a valid Git repo.

I can clone shared_repo and open the clone with no problem.

The question is, can I use SourceTree to open, view (and possibly modify) shared_repo , or can SourceTree only work with standard git repo's that have a working tree and a .git subfolder?

4 answers

1 accepted

SourceTree can't open bare repositories directly, it's a client tool for developers primarily. You can of course use bare repositories as remotes (that's what 99% of remotes are after all), all you need is an access path to them, which can be a file path or a URL. Just clone from them to create a local non-bare clone. You then modify the remote bare repo by pushing new changes to it as normal.

OK, thanks. Sort of what I figured. just wanted to be sure I wasn't missing something obvious. The other tools I tried had no problems with opening bare repos.

In practice 90% of SourceTree's functionality is useless on a bare repo (the only thing you can do is view/search the log), I have a feature request logged for it but it's low priority because of this, and the fact that no-one's asked for it (until now!).

Creating a local non-bare clone doesn't work if you want to use the repository as a shared repository for use with git-subtree. To be usable, the local copy needs to be bare. That makes it valuable to be able to work with it in all the same ways that one would work with the bare repositories at BitBucket (e.g. commit graphs, code viewing, differences, etc.) -- all without network access. Plus one would like to be able to push/pull between the local copy and the BitBucket copy while one does have internet access.

I'm in Jira right now and I can't find the feature request for the ability to view the log of a bare repository. I would like to vote that issue up. Do you have a link? Thanks.

I don't seem to have permission to view that issue. The link doesn't work. I get "Permission Violation. It seems that you have tried to perform an operation which you are not permitted to perform. If you think this message is wrong, please contact your JIRA administrators."

Not sure why that was private, I've made it public.

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...

572 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