Cannot add existing subtree to SourceTree

Donovan_Mueller March 23, 2014

Following these instructions, I created subtree through the terminal. I added a remote for it (hosted at GitHub) and everything has been working as expected on the terminal. However, in Subtree when I try to "add/link" the subtree it keeps complaining that it already exists.

Is there any way to get SourceTree to recognize the subtree without removing it and recreating it through SourceTree?

7 answers

1 accepted

1 vote
Answer accepted
Donovan_Mueller May 22, 2014

Kieran Senior's comment fixed the problem for me:

Yeah, this is because it's supposed to be a relative path. The dialog label says "Local relative path" but we don't detect for this at the moment. Unfortunately Git's errors aren't of much help. The Git command lets you carry on regardless.

If it's an existing path (the paths must always be within your main repository directory), then you create a link. Adding a subtree to an existing path yields in a Git error. If it's a brand new subtree then it needs to be a non-existent directory in your repository directory.

We've got a couple of open issues to improve this so when you select a folder using the directory picker (the triple dot button) then it'll yield a relative path, or if it's outside your repo folder then it'll yield an error. I've been meaning to do this but only a couple of people spotted it. That adds two more to my list now.

In your case it looks like the path should be web/sites/all/modules/asset_saver

Cheers

It should be noted that the [...] button next to the "Local Relative Path:" field generates an absolute path instead of the required relative path.

Deleted user August 2, 2017

3 August 2017

THIS BUG IS NOW THREE YEARS OLD AND STILL PRESENT.

How about fixing it...

It is intuitive to trust the directory picker.  It has taken me hours to solve why every subtree I add crashes.

bariserkus April 11, 2019

Hello,

I guess this bug is still there. 

For inexperienced users: Do not click the [...] and select the path of the subtree project.

Simple enter the folder name of the subtree project (not a path in the form of c:\my project\subtree project) into the space provided. I suggest to select a folder name without spaces and special characters.

Baris

Like # people like this
Matteo Vittorio Ricciutelli January 25, 2022

2022 BUG STILL THERE, don't click [...] just write the folder/path name you want to create and don't pick it via explorer...god this has been so frustrating!

2 votes
abumalick May 6, 2016

I spend more than an hour trying to add a subtree because of the "source path/url" and "Local relative path". I use source tree 1.8.3.0

Thanks to God, it worked very well in the end. But I had to create the subtree as follow :

1 "Local relative path": It has to be relative to the main project

2 "Local relative path": it has to have linux slashes ( / ) ad not backslashes ( \ ), else the git command don' t work.

3 "Source path / url" has to be a local path on my computer, it didn't worked with a private repository on bitbucket...

Well, that part of sourcetree need some debugging, but at least now it works very well.

 

Thank you for the fantastic Source Tree !

1 vote
MIkhail Turilin May 21, 2014

This is not what's happenning. It doesn't get to this dialog showing error before.

Donovan_Mueller May 21, 2014

This is not an answer, this is a comment. Please delete this and add it as a comment on the answer you're responding to.

1 vote
KieranA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2014

If it's asking to create a link, you simply say "Create Link". All this does is create a link between the specified repository and that sub-folder of your repository within SourceTree. It's metadata stored by SourceTree, nothing more. This is used so you can perform subtree actions without having to specify the remote each time.

Subtree is very disconnected in that no metadata is stored for each subtree, so we store it for you so you can perform actions quickly. If you were to do this at the terminal you'd have to specify the remote each time, with SourceTree you don't.

I'm assuming we're talking about the above dialog. The message tells you what's happening and that it won't affect anything.

Donovan_Mueller May 21, 2014

This is not the problem. I don't even get to that dialog. Screenshot of the error message.

MIkhail Turilin May 21, 2014

This is not what's happenning. It doesn't get to this dialog showing error before.

KieranA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 22, 2014

Yeah, this is because it's supposed to be a relative path. The dialog label says "Local relative path" but we don't detect for this at the moment. Unfortunately Git's errors aren't of much help. The Git command lets you carry on regardless.

If it's an existing path (the paths must always be within your main repository directory), then you create a link. Adding a subtree to an existing path yields in a Git error. If it's a brand new subtree then it needs to be a non-existent directory in your repository directory.

We've got a couple of open issues to improve this so when you select a folder using the directory picker (the triple dot button) then it'll yield a relative path, or if it's outside your repo folder then it'll yield an error. I've been meaning to do this but only a couple of people spotted it. That adds two more to my list now.

In your case it looks like the path should be web/sites/all/modules/asset_saver

Cheers

Donovan_Mueller May 22, 2014

That fixed the problem. The reason I didn't think about entering a relative path is because I just used the [...] (browse) button and it generated an absolute path. I assumed that whatever it generated would be valid.

Shallow Thought May 22, 2014

It does not work here.

My dir is as follows:

ProjectDir/subtrees/AFNetworking

When trying to link the subtree to Sourcetree, I use:

subtrees/AFNetworking

as relative path but I get the "already exists" error shown in the original question.

MIkhail Turilin May 23, 2014

Same here. Changing manually to the realtive path didn't solve the problem.

Donovan_Mueller May 25, 2014

You guys may want to start a new question since it seems like this solution isn't working for you. It may be that the Atlassian members already see this question as solved and so are ignoring further comments on it.

1 vote
MIkhail Turilin May 20, 2014

I also have this problem

Donovan_Mueller May 21, 2014

This is not an answer, this is a comment. Please delete this and move it to a comment on the main question.

Like # people like this
0 votes
Shallow Thought May 22, 2014

+1

same issue

Repro szenario:

0 votes
KieranA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 20, 2014

There were a couple of fixes issued, so this shouldn't be happening any more. What version are you on?

MIkhail Turilin May 20, 2014

I use 1.9.2

Donovan_Mueller May 20, 2014

I am also on 1.9.2

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events