Sourcetree: ??? in Windows Account name cloning from Bitbucket
Asked by andersbrohall:

Hi,

Trying to clone a HG-repo, i get this error:

```
Command: perl.exe "C:\Users\Anders Broh?ll\AppData\Local\SourceTree\app-3.0.15\tools\svn.pl" info https://whoever@bitbucket.org/whatever/whatever.web
Output: 
Error: System.ComponentModel.Win32Exception: The system cannot find the file specified

Command: hg identify extensions.hgext.hgsubversion=! https://andersbrohall@bitbucket.org/whatever/whatever.public.web
Output: 
Error: *** failed to import extension mercurial_credential_manager from C:\Users\Anders Broh?ll\AppData\Local\Atlassian\SourceTree\hg_extras\mercurial_credential_manager.py: [Errno 2] No such file or directory: 'C:/Users/Anders Broh\xc3\xa4ll/AppData/Local/Atlassian/SourceTree/hg_extras/mercurial_credential_manager.py'
*** failed to import extension hgext.hgflow from C:\Users\Anders Broh?ll\AppData\Local\SourceTree\app-3.0.15\extras\hgext\hgflow\hgflow.py: [Errno 2] No such file or directory: 'C:/Users/Anders Broh\xc3\xa4ll/AppData/Local/SourceTree/app-3.0.15/extras/hgext/hgflow/hgflow.py'
abort: http authorization required for https://bitbucket.org/whatever/whatever.public.web

Command: git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks ls-remote https://whoever@bitbucket.org/whatever/whatever.public.web
Output: 
Error: fatal: ArgumentException encountered.
 An item with the same key has already been added.
remote: Mercurial (hg) is required to use this repository.
remote: 
remote: https://confluence.atlassian.com/x/vLRCMw
fatal: unable to access 'https://whoever@bitbucket.org/whatever/whatever.public.web/': The requested URL returned error: 405
```

I'm guessing that the mercurial extension of Sourcetree doesn't work well with the '?' in my Windows account catalogue. No?

When can I expect that to be fixed?  
Can I somehow make it work by adjusting the perl script in the meantime?

Thanks,

Anders


Answers:
author: Zolt?n Boros
body: In 2021, the issue still exists. I think you at Atlassian should consider to make installation directory selectable. Windows' directory structure is a mess.


author: runegronkjaer
body: I have the exact same problem. So it's still an issue in Sourcetree v3.1.3.

A big problem for us with special characters in our names :/

/Rune


author: andersbrohall
body: When can i expect this to be working?\`

comments: author: runegronkjaer
body: Did you ever create a bug report here <https://jira.atlassian.com/projects/SRCTREEWIN/issues/SRCTREEWIN-12154?filter=allissues>

/Rune


author: Mike Corsaro
body: Hello! This is *probably*an unintended result of a security fix we previously shipped.

Could you first see if the file it's referring to actually exists?

```
C:\Users\Anders Broh?ll\AppData\Local\Atlassian\SourceTree\hg_extras\mercurial_credential_manager.py
```

If it *does*exist, then you can probably work-around this issue by just running the command yourself via the command-line/terminal (make sure you're in the right directory first!)

```
hg clone https://whoever@bitbucket.org/whatever/whatever.public.web
```

comments: author: andersbrohall
body: Yes, the file exists on disk.

```
C:\Users\Anders Broh?ll\AppData\Local\Atlassian\SourceTree\hg_extras\mercurial_credential_manager.py
```

I want to use SourceTree not the command line :)  
... no command works in the UI as per now, neither clone/commit/push/pull etc. With similar errors.

Can i downgrade to before the 'fix'?  
When can i expect a fix for the fix to be released?


author: shurub3l
body: I have the same problem, but I think it's because of the space in the Windows user folder. I can't use any git commands on the repo (fetch, pull, push, etc).

Here is the full output for a command:

```
git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks -c credential.helper= -c credential.helper="C:/Users/Marius Stanescu/AppData/Local/ATLASS~1/SOURCE~1/GIT_EX~1/git-credential-manager.exe" fetch origin
C:/Users/Marius Stanescu/AppData/Local/ATLASS~1/SOURCE~1/GIT_EX~1/git-credential-manager.exe get: C:/Users/Marius: No such file or directory
C:/Users/Marius Stanescu/AppData/Local/ATLASS~1/SOURCE~1/GIT_EX~1/git-credential-manager.exe erase: C:/Users/Marius: No such file or directory
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/Archive360/FCA.Forklift/'

C:/Users/Marius Stanescu/AppData/Local/ATLASS~1/SOURCE~1/GIT_EX~1/git-credential-manager.exe get: C:/Users/Marius: No such file or directory
C:/Users/Marius Stanescu/AppData/Local/ATLASS~1/SOURCE~1/GIT_EX~1/git-credential-manager.exe erase: C:/Users/Marius: No such file or directory
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/Archive360/FCA.Forklift/'

C:/Users/Marius Stanescu/AppData/Local/ATLASS~1/SOURCE~1/GIT_EX~1/git-credential-manager.exe get: C:/Users/Marius: No such file or directory
C:/Users/Marius Stanescu/AppData/Local/ATLASS~1/SOURCE~1/GIT_EX~1/git-credential-manager.exe erase: C:/Users/Marius: No such file or directory
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/Archive360/FCA.Forklift/'

C:/Users/Marius Stanescu/AppData/Local/ATLASS~1/SOURCE~1/GIT_EX~1/git-credential-manager.exe get: C:/Users/Marius: No such file or directory
C:/Users/Marius Stanescu/AppData/Local/ATLASS~1/SOURCE~1/GIT_EX~1/git-credential-manager.exe erase: C:/Users/Marius: No such file or directory
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/Archive360/FCA.Forklift/'

Completed with errors, see above.
```


author: Mike Corsaro
body: To work around this for now:

* Install [git-for-windows](https://git-scm.com/download/win)
* Go to Tools \> Options \> Git
* Under "Git Version" click "System"

[@andersbrohall](/t5/user/viewprofilepage/user-id/2348472)the same fix should work for you, but replace "git" with "mercurial" and [download it here](https://www.mercurial-scm.org/downloads)


author: andersbrohall
body: Still not working :/

Im on SourceTree 3.0.15.  
Using Mercurial 4.8.2 x64.  
The repo is on Bitbucket.

![Screenshot 2019-01-31 at 12.25.38.png](https://community.atlassian.com/t5/image/serverpage/image-id/44193i689B30E7841A1B44/image-size/large?v=v2&px=999 "Screenshot 2019-01-31 at 12.25.38.png")![Screenshot 2019-01-31 at 12.24.55.png](https://community.atlassian.com/t5/image/serverpage/image-id/44194iEAED472D569F89CA/image-size/large?v=v2&px=999 "Screenshot 2019-01-31 at 12.24.55.png")


author: Mike Corsaro
body: Okay, here's a workaround that should work:

* Create a folder that doesn't contain special characters and copy the contents of "C:\\Users\\USERNAME\\AppData\\Local\\Atlassian\\SourceTree\\hg_extras" into that folder
* Open the file "C:\\Users\\USERNAME\\AppData\\Local\\Atlassian\\SourceTree\\hgrc_sourcetree"
  * Under the entry for "mercurial_credential_manager" set the path to the folder you created


author: Mike Corsaro
body: FYI: This appears to be an issue in Mercurial itself as modifying the global .hgrc file to point the credential manager extension to a folder with an "?" and running from command-line also causes it to fail.


author: andersbrohall
body: It does work, modifying the hgrc_sourcetree-file. However, it reverts to the original path when opening SourceTree.

I need to modify the hgrc_sourcetree AFTER SourceTree opened. I need to modify it everytime I open it. Enervating.


Tags: bitbucket

bitbucket-cloud

cloud