Sourcetree cannot handle backslash in URL of git repository on a computer share

G B February 8, 2018

When I specify for the repository location in Repository Settings at URL/Path:

\\\\BC01245\\myproject

(which is a local shared folder on my computer hosting a bare git repository),

several actions make sourcetree change the config file of the cloned repository and sourcetree inserts extra backslashes:

url = \\\\\\\\BC01245\\\\myproject

fetch = +refs/heads/*:refs/remotes/origin/*

pushurl = \\\\\\\\BC01245\\\\myproject

which cause other applications that use this repository to complain about not finding the repository.

Is this a known problem or is there a way to work around this?

 

1 answer

0 votes
minnsey
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 12, 2018

Hi

What happens if you try adding the same remote using command line git?

G B February 14, 2018

There is a problem with the backslashes in the MINGW32 terminal started up and probably used by source tree. I have never seen these emulators (cygwin/ming) work without problems on windows. The terminal just refuses the windows machine name notation, it only accepts a unix server name or the windows drive mapping notation to this share (file:://z:).

Here are the details, note git for windows (last one) just works fine:
Terminal started from sourcetree MINGW32:

Welcome to Portable Git (version 1.9.5-preview20141217)

$ which git
/bin/git

  • 4 backslashes do not work:
        USER@BC1234 /d/Models/test
        $ git clone \\\\BC1234\\repo myrepotest1
        Cloning into 'myrepotest1'...
        fatal: '\BC1234\repo' does not appear to be a git repository
        fatal: Could not read from remote repository.

        Please make sure you have the correct access rights
        and the repository exists.
  • 5 backslashes do not work:
        USER@BC1234 /d/Models/test
        $ git clone \\\\\BC1234\\repo myrepotest1
        Cloning into 'myrepotest1'...
        fatal: '\BC1234\repo' does not appear to be a git repository
        fatal: Could not read from remote repository.
  • 6 backslashes do not work:
        USER@BC1234 /d/Models/test
        $ git clone \\\\\\BC1234\\repo myrepotest1
        fatal: repository '\\\BC1234\repo' does not exist

  • fine:    
        USER@BC1234 /d/Models/test
        $ git clone file://z: myrepotest1
        Cloning into 'myrepotest1'...
        done.
        cat myrepotest1/.git/config
        url = file://z:
  • fine when using unix server notation (although url now in unix format in config file, compatible with other applications?):    
        USER@BC1234 /d/Models/test
        $ git clone  //BC1234/repo myrepotest2
        Cloning into 'myrepotest2'...
        done.
        cat myrepotest2/.git/config
        url = //BC1234/repo
  • Runs fine on git for windows:
      Git for Windows v2.14.2 Release Notes

        D:\Models\test>git clone \\BC1234\repo myrepoclone4
        Cloning into 'myrepoclone4'...
        done.

        D:\Models\test>which git
        C:/Program Files/Git/cmd/git.EXE        

              url = \\\\BC1234\\repo  

       
     

minnsey
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 15, 2018

Thanks for all the details.

For what its worth Sourcetree doesn't  run git within a terminal, instead it either uses libgit2 or directly runs the Sourcetree for Windows git.exe within a .NET process.

I would expect Runs fine on git for windows: yto apply to Sourcetree since we ship with Git 2.15+ now.

If you find using Sourcetree with Git 2.15+ still doesn't work for \\blah\repo style urls please create a ticket at https://jira.atlassian.com

Thanks

G B February 15, 2018

Thanks for your comment. I am using version 2.3.5, I will try to log a ticket next week. As a workaround I use double forward slashes before the computer name (//BC1234/repo). Git, Sourcetree and other applications understand this non-official UNC path notation.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events