how to open/view a shared (bare) git repository w/ SourceTree?
Asked by Ian Scott-Fleming:

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?


Answers:
author: stevestreeting
body: 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.

comments: author: Ian Scott-Fleming
body: 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.


author: stevestreeting
body: 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!).


author: Eric Anderson
body: 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.


author: bucketfist
body: 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."

comments: author: stevestreeting
body: Not sure why that was private, I've made it public.


author: bucketfist
body: Other similar links, such as <https://jira.atlassian.com/browse/SRCTREE-697> do work.

<https://jira.atlassian.com/browse/SRCTREE-69> however, does not.


author: bucketfist
body: 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.

comments: author: stevestreeting
body: It's here: <https://jira.atlassian.com/browse/SRCTREE-69>