Adding a subtree: Invalid path errors

I just tried to add a github hosted repository as a subtree to my current project. I get an error for each file like:

* branch master -> FETCH_HEAD
error: Invalid path '/Users/kay/Development/git/MyProject/Assets/Editor/BundleVersionChecker/.gitignore'

The URL is reported as Git repository, there is only the master branch as I just have started and the local relative path points to a non-existing directory name immediately under an existing directory.

I use the embedded git version of SourceTree 1.9.0 reported as Confusingly when I enter git subtree I get:

git: 'subtree' is not a git command. See 'git --help'.

I am new to subtrees but used this project as a submodule before. What I am doing wrong here?


1 answer

1 accepted

Hey Kayy,

Could you paste the entire output you're experiencing from the start? Perhaps put it in a pastebin for easier reading.

As for the latter problem you're experiencing, subtree is an extension. The command line Git you're using is actually different from the one SourceTree uses (if using embedded). The SourceTree documentation tells you all about this, actually, and provides a link with a guide to getting it working here:

Hopefully the latter part helps, let me know about the former point.


I tried it again after committing the next changes and suddenly it worked. I didn't change anything else - well this is what all the guys saying ;) Anyway, thanks a lot for shedding some light on the 2nd problem.

My previous comment was wrong in that I accidentally created a submodule (which worked fine).

Now I tried to create a subtree again for another sub-project. At first I ran into the same problems but finally found the solution: The 'Add Subtree' dialog lets you select a directory and uses that as the full path. Editing it to be a relative path as stated in the label fixes the problem.

Maybe a future version of SourceTree can handle this automatically.

Suggest an answer

Log in or Join to answer
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

262 views 0 3
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot