• Icon: Bug Bug
    • Resolution: Tracked Elsewhere
    • Icon: Medium Medium
    • None
    • 1.8.0.2
    • None
    • None
    • Mac OSX 10.8.5
      Embedded Git 1.8.4.2
      System Git 1.8.3.4 (for command line uses)

      I can't add a new subtree or link to an existing subtree.

      The repositories are on Bitbucket (sorry I can't put a link to them, they're private. If it's necessary I can create fake repos).

      If I try to add a new subtree on a non-existing folder, Sourcetree asks for my password, I enter it, and later I get these errors:

      -------------------------------------------------------------------------------------

      git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree subtree add -P /Users/sergidiaz/Desarrollo/XXX-for-android/jni/Test https://sergidiaz@bitbucket.org/YYY/XXX-for-ios.git master

      2013-12-13 13:02:29.146 git-credential-sourcetree[8201:707] Error (internetKeychainItemForServer:withUsername:path:port:protocol - The specified item could not be found in the keychain.

      From https://bitbucket.org/YYY/XXX-for-ios

      • branch master -> FETCH_HEAD

      error: Invalid path '/Users/sergidiaz/Desarrollo/XXX-for-android/jni/Test/.gitignore'

      error: Invalid path '/Users/sergidiaz/Desarrollo/XXX-for-android/jni/Test/.gitmodules'

      error: Invalid path '/Users/sergidiaz/Desarrollo/XXX-for-android/jni/Test/3D Assets/Balon.FBX'

      error: Invalid path '/Users/sergidiaz/Desarrollo/XXX-for-android/jni/Test/3D Assets/CAMP.mesh'

      (More Invalid path errors, one for each file...)

      error: pathspec 'jni/Test' did not match any file(s) known to git.

      Completed with errors, see above

      -------------------------------------------------------------------------------------

      If I create the folder I simply get a "prefix already exists" error.

      If I create a subtree using the command line, following this guide from your own blog (http://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/) and then I try to link to it, I get the same "prefix already exists" error.

            [SRCTREE-2000] Can't add or link a subtree

            Thanks. (I'll wait for the update in SourceTree)

            joostfontein added a comment - Thanks. (I'll wait for the update in SourceTree)

            KieranA added a comment -

            Hey Joost,

            The associated issue for squash is SRCTREE-2024.

            To get subtree working on the command line you'll want to follow this guide: http://engineeredweb.com/blog/how-to-install-git-subtree/

            Cheers!

            KieranA added a comment - Hey Joost, The associated issue for squash is SRCTREE-2024 . To get subtree working on the command line you'll want to follow this guide: http://engineeredweb.com/blog/how-to-install-git-subtree/ Cheers!

            Hi Kieran,

            Can I track somewhere what the status is of feature request to add 'squash' commits on adding a subtree?

            For the meanwhile: How do I use commandline and include "--squash" in the command line? (I'm not into command line at all ...)

            • I clicked Terminal
            • Terminal went to correct directory
            • I entered:
              "git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree subtree pull -P dev3 --squash git@bitbucket.org:username/reponame.git master"
            • Terminal responded:
              git: 'subtree' is not a git command. See 'git --help'.
            • When I do git --version:
              1.8.0

            joostfontein added a comment - Hi Kieran, Can I track somewhere what the status is of feature request to add 'squash' commits on adding a subtree? For the meanwhile: How do I use commandline and include "--squash" in the command line? (I'm not into command line at all ...) I clicked Terminal Terminal went to correct directory I entered: "git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree subtree pull -P dev3 --squash git@bitbucket.org:username/reponame.git master" Terminal responded: git: 'subtree' is not a git command. See 'git --help'. When I do git --version: 1.8.0

            Case A: yes I used SourceTree. Tried again => same results.
            (Well ... case B works. So think that is fine for now).

            Case B:
            OK. That would be nice!

            joostfontein added a comment - Case A: yes I used SourceTree. Tried again => same results. (Well ... case B works. So think that is fine for now). Case B: OK. That would be nice!

            KieranA added a comment -

            Hey Joost,

            In case A, did you add the subtree using SourceTree? Are you sure it's named 'dev2'?

            As for case B, there's a feature request open to add 'squash' commits on adding a subtree.

            Cheers

            KieranA added a comment - Hey Joost, In case A, did you add the subtree using SourceTree? Are you sure it's named 'dev2'? As for case B, there's a feature request open to add 'squash' commits on adding a subtree. Cheers

            Case A
            After adding the subtree, I did a pull with this result:
            git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree subtree pull -P dev2 --squash git@bitbucket.org:XXXX/YYYY.git master
            From bitbucket.org:org:XXXX/YYYY

            • branch master -> FETCH_HEAD
              Can't squash-merge: 'dev2' was never added.
              Completed with errors, see above

            If I do a pull without squash commits, it does pull. However, all files appear in the root of the repo; not in dev2.. (Specifying the LocalRelativePath like dev2/, /dev2 or /dev2/ doesn't help)

            Case B
            Does work. However, when adding the subtree, it immediately does a pull. There is no option to ask for "squash commits", so it ends up with a complete list of commits..

            joostfontein added a comment - Case A After adding the subtree, I did a pull with this result: git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree subtree pull -P dev2 --squash git@bitbucket.org:XXXX/YYYY.git master From bitbucket.org:org:XXXX/YYYY branch master -> FETCH_HEAD Can't squash-merge: 'dev2' was never added. Completed with errors, see above If I do a pull without squash commits, it does pull. However, all files appear in the root of the repo; not in dev2.. (Specifying the LocalRelativePath like dev2/, /dev2 or /dev2/ doesn't help) Case B Does work. However, when adding the subtree, it immediately does a pull. There is no option to ask for "squash commits", so it ends up with a complete list of commits..

            KieranA added a comment -

            If you don't mind I'm going to close this and link it to the issue that's aimed at fixing it. All the information in this issue will be used though to get some sort of fix implemented to stop users from using absolute paths or paths that are outside the scope of the repository.

            Cheers

            KieranA added a comment - If you don't mind I'm going to close this and link it to the issue that's aimed at fixing it. All the information in this issue will be used though to get some sort of fix implemented to stop users from using absolute paths or paths that are outside the scope of the repository. Cheers

            KieranA added a comment -

            My test cases:

            Case A
            git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree subtree add -P /Volumes/OTHER/Sparkle/Test https://Kezzer@bitbucket.org/Kezzer/testing.git master 
            prefix '/Volumes/OTHER/Sparkle/Test' already exists.
            Completed with errors, see above
            

            Easy to reproduce. Paths should always be relative. The prefix you've used in this case is absolute. Admittedly this is a fault of the file picker that's used which will, when choosing certain directories, use the full absolute path. To fix this problem, just use the local relative path (local to the repo).

            Case B
            git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree subtree add -P /Volumes/OTHER/Sparkle/Blah https://Kezzer@bitbucket.org/Kezzer/testing.git master 
            From https://bitbucket.org/Kezzer/testing
             * branch            master     -> FETCH_HEAD
            error: Invalid path '/Volumes/OTHER/Sparkle/Blah/.gitmodules'
            error: Invalid path '/Volumes/OTHER/Sparkle/Blah/apowdj.markdown'
            error: Invalid path '/Volumes/OTHER/Sparkle/Blah/submod'
            error: pathspec 'Blah' did not match any file(s) known to git.
            git fetch https://Kezzer@bitbucket.org/Kezzer/testing.git master
            Completed with errors, see above
            

            Again, easy to reproduce because of the non-relative path that's used. Git is executing in the context of the repository, so just use a relative path. Here's the output when using a relative path instead:

            git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree subtree add -P Blah https://Kezzer@bitbucket.org/Kezzer/testing.git master 
            From https://bitbucket.org/Kezzer/testing
             * branch            master     -> FETCH_HEAD
            Added dir 'Blah'
            git fetch https://Kezzer@bitbucket.org/Kezzer/testing.git master
            Completed successfully
            

            As a result of these findings I'm assuming we could produce a warning for absolute paths. The same problem would occur if you would do it at the terminal in effect. It's just because of the context in which Git is running, and expecting paths relative to itself. Git doesn't know where the current repository it's running from could be located. This is why absolute paths are no good, you can move repositories around wherever you want, at which point the paths will break.

            I think we need to turn this into a feature request to firstly warn users about using absolute paths and secondly try and get that folder picker to use relative paths where possible.

            KieranA added a comment - My test cases: Case A git -c diff.mnemonicprefix= false -c core.quotepath= false -c credential.helper=sourcetree subtree add -P /Volumes/OTHER/Sparkle/Test https: //Kezzer@bitbucket.org/Kezzer/testing.git master prefix '/Volumes/OTHER/Sparkle/Test' already exists. Completed with errors, see above Easy to reproduce. Paths should always be relative . The prefix you've used in this case is absolute. Admittedly this is a fault of the file picker that's used which will, when choosing certain directories, use the full absolute path. To fix this problem, just use the local relative path (local to the repo). Case B git -c diff.mnemonicprefix= false -c core.quotepath= false -c credential.helper=sourcetree subtree add -P /Volumes/OTHER/Sparkle/Blah https: //Kezzer@bitbucket.org/Kezzer/testing.git master From https: //bitbucket.org/Kezzer/testing * branch master -> FETCH_HEAD error: Invalid path '/Volumes/OTHER/Sparkle/Blah/.gitmodules' error: Invalid path '/Volumes/OTHER/Sparkle/Blah/apowdj.markdown' error: Invalid path '/Volumes/OTHER/Sparkle/Blah/submod' error: pathspec 'Blah' did not match any file(s) known to git. git fetch https: //Kezzer@bitbucket.org/Kezzer/testing.git master Completed with errors, see above Again, easy to reproduce because of the non-relative path that's used. Git is executing in the context of the repository, so just use a relative path. Here's the output when using a relative path instead: git -c diff.mnemonicprefix= false -c core.quotepath= false -c credential.helper=sourcetree subtree add -P Blah https: //Kezzer@bitbucket.org/Kezzer/testing.git master From https: //bitbucket.org/Kezzer/testing * branch master -> FETCH_HEAD Added dir 'Blah' git fetch https: //Kezzer@bitbucket.org/Kezzer/testing.git master Completed successfully As a result of these findings I'm assuming we could produce a warning for absolute paths. The same problem would occur if you would do it at the terminal in effect. It's just because of the context in which Git is running, and expecting paths relative to itself. Git doesn't know where the current repository it's running from could be located. This is why absolute paths are no good, you can move repositories around wherever you want, at which point the paths will break. I think we need to turn this into a feature request to firstly warn users about using absolute paths and secondly try and get that folder picker to use relative paths where possible.

            I get the same types of errors, only my drive is my local hard drive, not a network drive.

            I've tried it all the ways I can think of, but currently I have it setup via the command line as described here:
            http://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/

            When I try to make the link in sourcetree I get this error message:

            git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree subtree add -P /Users/XXX/Code/XXX-test/assets/XXX_components/XXX https://XXX@bitbucket.org/XXX/XXX.git master
            prefix '/Users/XXX/Code/XXX-test/assetsXXX_components/XXX' already exists.
            Completed with errors, see above

            Peter Murphy added a comment - I get the same types of errors, only my drive is my local hard drive, not a network drive. I've tried it all the ways I can think of, but currently I have it setup via the command line as described here: http://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/ When I try to make the link in sourcetree I get this error message: git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree subtree add -P /Users/XXX/Code/XXX-test/assets/XXX_components/XXX https://XXX@bitbucket.org/XXX/XXX.git master prefix '/Users/XXX/Code/XXX-test/assetsXXX_components/XXX' already exists. Completed with errors, see above

            It's a virtual drive. I use an encrypted file that is mounted as volume using TrueCrypt.

            joostfontein added a comment - It's a virtual drive. I use an encrypted file that is mounted as volume using TrueCrypt.

            KieranA added a comment -

            Hey Joost,

            This is a very important detail. There are many, many caveats when various operations when it comes to non-local drives, whether it's external storage or NAS. Could you just mention whether it's a network attached drive or over USB?

            Cheers

            KieranA added a comment - Hey Joost, This is a very important detail. There are many, many caveats when various operations when it comes to non-local drives, whether it's external storage or NAS. Could you just mention whether it's a network attached drive or over USB? Cheers

            joostfontein added a comment - - edited

            Case A (Add subtree to existing ../dev2 directory):


            git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree subtree add -P /Volumes/IC_GIT/XML_TEST/dev2 git@bitbucket.org:username/icnl_go.git master
            prefix '/Volumes/IC_GIT/XML_TEST/dev2' already exists.
            Completed with errors, see above


            Case B (Add subtree to non-existing ../dev2/abc directory)::


            git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree subtree add -P /Volumes/IC_GIT/XML_TEST/dev2/abc git@bitbucket.org:username/icnl_go.git master
            From bitbucket.org:username/icnl_go

            • branch master -> FETCH_HEAD
              error: Invalid path '/Volumes/IC_GIT/XML_TEST/dev2/abc/BOM.script'
              error: Invalid path '/Volumes/IC_GIT/XML_TEST/dev2/abc/BOMIncludes/0000 ReadMe.c'
              .. etc ..
              git fetch git@bitbucket.org:username/icnl_go.git master
              error: Invalid path '/Volumes/IC_GIT/XML_TEST/dev2/abc/Enumerators/Sewer.csv'
              error: Invalid path '/Volumes/IC_GIT/XML_TEST/dev2/abc/Ground/G1010_Car.Element'
              .. etc ..
              error: pathspec 'dev2/abc' did not match any file(s) known to git.
              Completed with errors, see above

            joostfontein added a comment - - edited Case A (Add subtree to existing ../dev2 directory): git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree subtree add -P /Volumes/IC_GIT/XML_TEST/dev2 git@bitbucket.org:username/icnl_go.git master prefix '/Volumes/IC_GIT/XML_TEST/dev2' already exists. Completed with errors, see above Case B (Add subtree to non-existing ../dev2/abc directory):: git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree subtree add -P /Volumes/IC_GIT/XML_TEST/dev2/abc git@bitbucket.org:username/icnl_go.git master From bitbucket.org:username/icnl_go branch master -> FETCH_HEAD error: Invalid path '/Volumes/IC_GIT/XML_TEST/dev2/abc/BOM.script' error: Invalid path '/Volumes/IC_GIT/XML_TEST/dev2/abc/BOMIncludes/0000 ReadMe.c' .. etc .. git fetch git@bitbucket.org:username/icnl_go.git master error: Invalid path '/Volumes/IC_GIT/XML_TEST/dev2/abc/Enumerators/Sewer.csv' error: Invalid path '/Volumes/IC_GIT/XML_TEST/dev2/abc/Ground/G1010_Car.Element' .. etc .. error: pathspec 'dev2/abc' did not match any file(s) known to git. Completed with errors, see above

            KieranA added a comment -

            Hey Joost,

            Strange. Subtree in SourceTree is designed to create link metadata rather than try and re-add. Can I get the full output with any private information redacted?

            Thanks

            KieranA added a comment - Hey Joost, Strange. Subtree in SourceTree is designed to create link metadata rather than try and re-add. Can I get the full output with any private information redacted? Thanks

            I have exactly the same.

            About the 'prefix already exists error' in Sergi's case:
            He wants to add the subtree to the ../jni/Test directory. So there are 2 situations:
            (A) /Test has already been created in ../jni
            ==> you get the error "prefix .../jni/Test already exists"
            (B) /Test has not been created in ../jni
            ==> you get the error "Invalid path"

            joostfontein added a comment - I have exactly the same. About the 'prefix already exists error' in Sergi's case: He wants to add the subtree to the ../jni/Test directory. So there are 2 situations: (A) /Test has already been created in ../jni ==> you get the error "prefix .../jni/Test already exists" (B) /Test has not been created in ../jni ==> you get the error "Invalid path"

            KieranA added a comment -

            Could you tell me more about the 'prefix already exists' error? I don't know where this is being generated from or the contents of the message.

            Thanks in advance.

            KieranA added a comment - Could you tell me more about the 'prefix already exists' error? I don't know where this is being generated from or the contents of the message. Thanks in advance.

            I am also getting this error. Everything seems to be authed ok.

            Jake Bishop added a comment - I am also getting this error. Everything seems to be authed ok.

            KieranA added a comment -

            Hey Sergi

            2013-12-13 13:02:29.146 git-credential-sourcetree[8201:707] Error (internetKeychainItemForServer:withUsername:path:port:protocol- The specified item could not be found in the keychain.

            This is generated because you didn't auth correctly. Are you certain you're using the correct authentication details?

            How are you attempting to link? Just going to the "Add/Link Subtree..." option and specifying the relevant paths?

            Cheers

            KieranA added a comment - Hey Sergi 2013-12-13 13:02:29.146 git-credential-sourcetree [8201:707] Error (internetKeychainItemForServer:withUsername:path:port:protocol- The specified item could not be found in the keychain. This is generated because you didn't auth correctly. Are you certain you're using the correct authentication details? How are you attempting to link? Just going to the "Add/Link Subtree..." option and specifying the relevant paths? Cheers

              Unassigned Unassigned
              4ebd4a7a51c7 Sergi Díaz
              Affected customers:
              1 This affects my team
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: