Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to clone repository after upgrading to Git v2.5.0 #845

Closed
molehillrocker opened this Issue Aug 26, 2015 · 18 comments

Comments

Projects
None yet
6 participants
@molehillrocker
Copy link

molehillrocker commented Aug 26, 2015

I recently ran choco upgrade all, which updated Git from v1.9.5.20150320 to v2.5.0. Since then, I am not able to clone repositories anymore. When I hit git tfs clone http://myserver:8080/tfs/DefaultCollection $/myRepo it changes the repository to a weird looking absolute path: $/C:/Program Files/Git/myRepo.

Output of the command:

$ git tfs clone http://myServer:8080/tfs/DefaultCollection $/myRepo -d
Command run:git tfs clone http://myServer:8080/tfs/DefaultCollection $C:/Program Files/Git/myRepo test -d
No authors file used.
git-tfs version 0.22.0.0 (TFS client library 11.0.0.0 (MS)) (64-bit)
Sep.Git.Tfs.Core.GitTfsException: TFS repository can not be root and must start with "$/".
   at Sep.Git.Tfs.Util.GitTfsCommandRunner.Run(GitTfsCommand command, IList`1 args)
   at Sep.Git.Tfs.GitTfs.Main(GitTfsCommand command, IList`1 unparsedArgs)
   at Sep.Git.Tfs.Program.Main(String[] args)
TFS repository can not be root and must start with "$/".
You may be able to resolve this problem.
- Try using $/C:/Program Files/Git/myRepo

I downgraded to Git v1.9.5.20150320 and now everything works fine again, so I think it has something to do with the latest release of Git.

@pmiossec

This comment has been minimized.

Copy link
Member

pmiossec commented Aug 27, 2015

I know that I should validate git-tfs with Git 2.5 but I was aware of big changes (potentially breaking) in this release.
That's why I can't test it because I use git-tfs every day. So thanks for the test ;)
I should have a look to fix it but I don't know when I will be able to do it...

But indeed, that's a really really weird issue! :(

Perhaps guys of @git-for-windows knows about it and could help ( cc @dscho )

@dscho

This comment has been minimized.

Copy link

dscho commented Aug 27, 2015

It's most likely the overhauled POSIX-to-Windows path mangling of MSys2. Try

MSYS_NO_PATHCONV=1 git tfs clone http://myServer:8080/tfs/DefaultCollection $/myRepo -d

(This tip is also shown in the Release Notes.)

@molehillrocker

This comment has been minimized.

Copy link
Author

molehillrocker commented Aug 27, 2015

Sounds reasonable, thanks. I'll try that the next time I have access to the described repository (in ~2 weeks) and let you know the result. 😄

@pmiossec

This comment has been minimized.

Copy link
Member

pmiossec commented Aug 27, 2015

@dscho Thanks for the answer.

If that's the case, it is for me a bug/regression because the string that is modified doesn't began with a /. There is a $ at the beginning of the string (that has no meaning in unix paths) and the value should not be replaced.

Do you know where I can open a bug report to at least talk about that with the msys2 team?
here ?

@dscho

This comment has been minimized.

Copy link

dscho commented Aug 27, 2015

Please note that there is a Pull Request pending with Git for Windows' custom modification to the POSIX-to-Windows path mangling: Alexpux/Cygwin#8

The most likely path to success is to imitate dscho/msys2-runtime@6804f2a and open a Pull Request at https://github.com/git-for-windows/msys2-runtime/

If I read it right, it is unfortunately not enough to test for $ as first character because we still would want to mangle things like $PATH:/bin. So my guess is that the prefix $/ needs to be tested, although I have to admit that I have no clue about TFS paths. Yet. Maybe you can enlighten me?

@pmiossec

This comment has been minimized.

Copy link
Member

pmiossec commented Aug 28, 2015

So my guess is that the prefix $/ needs to be tested, although I have to admit that I have no clue about TFS paths. Yet. Maybe you can enlighten me?

Indeed, TFS paths always begin with $/ which is the root of the TFS repository. And this is something that should not be altered.

The most likely path to success is to imitate dscho/msys2-runtime@6804f2a and open a Pull Request at https://github.com/git-for-windows/msys2-runtime/

I will have a look and hoping my very few remaining knowledge in C will be enough....

@dscho

This comment has been minimized.

Copy link

dscho commented Aug 28, 2015

@pmiossec I just realized that I managed to forget to link to the most important information: https://github.com/git-for-windows/git/wiki/Building-msys2-runtime

With this documentation, you should be able to get directly to the patch (after letting the Git for Windows SDK do its thing during installation...).

@ComradeCow

This comment has been minimized.

Copy link

ComradeCow commented Aug 31, 2015

I'm seeing something similar, and it might be the same issue. I can't clone any TFS repository. I started with this command (using Bash):

$ git tfs clone --export http://my.tfs.server.com/path "$/Path/to/Project" FolderName -d
Command run:git tfs clone --export http://my.tfs.server.com/path $C:/Program Files/Git/Path/To/ Project FolderName -d
No authors file used.
git-tfs version 0.22.0.0 (TFS client library 12.0.0.0 (MS)) (64-bit)
Sep.Git.Tfs.Core.GitTfsException: TFS repository can not be root and must start with "$/".
   at Sep.Git.Tfs.Util.GitTfsCommandRunner.Run(GitTfsCommand command, IList`1 args)
   at Sep.Git.Tfs.GitTfs.Main(GitTfsCommand command, IList`1 unparsedArgs)
   at Sep.Git.Tfs.Program.Main(String[] args)
TFS repository can not be root and must start with "$/".
You may be able to resolve this problem.
- Try using $/C:/Program Files/Git/Path/To/Project

I tried using MSYS_NO_PATHCONV=1 per dscho's advice. It spits out a warning:

warning: you are going to clone the whole repository or too high in the repository path !
   => If you want to manage branches with git-tfs, clone one of this branch instead :

And then proceeds to list out every branch in the TFS server. When I run the same clone command from CMD, it acts the same as using the MSYS_NO_PATHCONV setting.

Haven't tried back-dating to a pre-2.0 Git yet. Using git version 2.5.1.windows.1 and git-tfs version 0.22.0.0 (TFS client library 12.0.0.0 (MS)) (64-bit)

@dscho

This comment has been minimized.

Copy link

dscho commented Sep 1, 2015

@ComradeCow you would not be able to provide me with an MCVE, would you?

@ComradeCow

This comment has been minimized.

Copy link

ComradeCow commented Sep 1, 2015

@dscho - Anything more in particular you're looking for? I don't know what else I can provide without using my company's specific server information, which isn't accessible off our network.

It must be failing out before it even contacts the server - I just ran it this morning with typos in both the server URL and the TFS Path, and it still failed out with the same error.

So maybe the MVCE is this command:

git tfs clone http://server.missing.com/path "$/Some Bad/Path" -d

Where http://server.missing.com/ doesn't exist. And $/Some Bad/Path is something non-root?

@dscho

This comment has been minimized.

Copy link

dscho commented Sep 1, 2015

Hmmm. I thought that warning about the repository being too high in the repository path was connected to a concrete TFS repository. Will try to find some time tomorrow to address at least the $/ part.

@pmiossec

This comment has been minimized.

Copy link
Member

pmiossec commented Sep 1, 2015

Hmmm. I thought that warning about the repository being too high in the repository path was connected to a concrete TFS repository. Will try to find some time tomorrow to address at least the $/ part.

No, this message is "normal". There is only the problem of $/ to fix.
But I think that git-tfs users could use the CMD or powershell (or set MSYS_NO_PATHCONV=1) to circumvent the problem...

@molehillrocker

This comment has been minimized.

Copy link
Author

molehillrocker commented Sep 8, 2015

Back on track again. 😄
I just wanted to confirm that prefixing the git tfs clone ... command with MSYS_NO_PATHCONV=1 as mentioned by @dscho works fine.

@molehillrocker

This comment has been minimized.

Copy link
Author

molehillrocker commented Sep 8, 2015

Using $//myRepo instead of $/myRepo works also, as stated in Git's release notes.

@ComradeCow

This comment has been minimized.

Copy link

ComradeCow commented Sep 22, 2015

Running the clone command using MSYS_NO_PATHCONV=1 and $// to start did the trick for me.

It still spat out the warning I mentioned above (cloning the entire repository path or too high in repository path) and listed every branch in the TFS server, but ultimately only cloned my requested path. So I'm not sure what the story there is. Based on the messages, I assumed it was cloning out the entire TFS server.

I am clone a specific sub folder in a Team Project, rather than the entire team project. Could that be related?

@pmiossec

This comment has been minimized.

Copy link
Member

pmiossec commented Sep 22, 2015

@ComradeCow The problem with the clone (with the workaround given) and the warning are 2 separate things.

The warning message is "normal". It try to tell you that what you are doing is probably not the thing you want to do. But that's just a warning because you could be aware of what you do ;)

if you clone "$/Path/to/Project", that's normal that git-tfs complain and warn you that you are cloning a path "too high" and surely end up with a flat history where all your branches will be in sub directories. And you won't get the advantages that git give you in term of branch support!
If you want branch support, perhaps you must clone "$/Path/to/Project/MyMainBranch" (and read the documentation that explain that well ;) ).

But stop discuss of that in this thread because that's not the subject of this thread ;)

@fourpastmidnight

This comment has been minimized.

Copy link
Contributor

fourpastmidnight commented Apr 15, 2016

Also see #940 for detailed instructions. But @dscho hit the nail on the head with

MSYS_NO_PATHCONV=1 git tfs clone http://myServer:8080/tfs/DefaultCollection $/myRepo -d

That was my same conclusion and it works perfectly every time. :)

@soultemptation

This comment has been minimized.

Copy link

soultemptation commented Jul 6, 2016

I had the same error message: "TFS repository can not be root and must start with "$/"."
The commands which have been tried were:

  • git tfs clone http://***:8080/tfs/DefaultCollection $/MOBS/DEV -d
  • git tfs clone http://***:8080/tfs/DefaultCollection $/MOBS/Web_DEV -d

The problem in my case was, that the branch graph of my desired branch (named "DEV") was corrupted. It was:
06 07

The two first branches (Web_DEV and DEVELOPMENT.Old) were not present anymore in the TFS. So it crashed with the message stated at the beginning of the thread.

After a "reparent" of the "DEV" branch, I got the following structure:
06 07-2

Now the following clone command was able to run:

  • git tfs clone http://***:8080/tfs/DefaultCollection $/MOBS/DEV -d

It will probably not help for every case this error occurs. But hopefully it will help somebody in the future.

Git version: 2.6.3.windows.1
git-tfs version: v0.25.0

@pmiossec pmiossec closed this Jan 28, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.