Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,298,035
Community Members
 
Community Events
165
Community Groups

Sourcetree Crashes when Cloning a Repository

Edited

I have been using Sourcetree with two Gitlab repositories for several months without any issues. Recently, I wanted to add a third repository and every time I try to clone the new repository to Sourcetree, it crashes (Sourcetree locks up and I have to use the Task Manager to close it) When I paste the HTTPS address from GitLab, Sourcetree recognizes the repository as a Git repository. A status circle starts spinning next to Advanced options and then Sourcetree freezes up.

The version of Sourcetree that I have installed is 3.4.5. Within the windows event viewer, I have noticed two errors that pop up. My colleague has been able to close the repository on his computer using Sourcetree without any issues. Do you have any ideas why this is happening?

Thanks,

Jason Harrington

9 answers

1 accepted

21 votes
Answer accepted

Hi, 

I had the same error.

I solved it as follows:

- uninstall version 3.4.5

- delete folder c:\Users\USERNAME\AppData\Local\Atlassian

- instal version 3.4.4 https://product-downloads.atlassian.com/software/sourcetree/windows/ga/SourceTreeSetup-3.4.4.exe

 

Miro

Miro,

Thank you so much! That fixed my problem.

-Jason

Thank you , fixed my problem.

if you don't want to revert to an older version of the software, see Aidan's answer below - making sure the repo is not empty worked for me as well.

Like # people like this

Niubi 👍

Still happens in version 3.4.7. 😥
The bug is not fixed yet.  (´・ω・`)

Like # people like this

I confirm. its still crashing at this step in 3.4.7 and 3.4.4 works

Like # people like this

Having the same issue with version 3.4.7. Found the following error information in Windows Event Viewer:

Application: SourceTree.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IndexOutOfRangeException
at SourceTree.Repo.RepoHandlerGitOld.GetDefaultBranch(System.String)
at SourceTree.ViewModel.CloneNewDialogViewModel+<>c__DisplayClass212_0.<RefreshRemoteBranches>b__1()
at System.Threading.Tasks.Task`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].InnerInvoke()
at System.Threading.Tasks.Task.Execute()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
at System.Runtime.CompilerServices.TaskAwaiter`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].GetResult()
at SourceTree.ViewModel.CloneNewDialogViewModel+<RefreshRemoteBranches>d__212.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at SourceTree.ViewModel.CloneNewDialogViewModel+<CheckSource>d__211.MoveNext()

Exception Info: ReactiveUI.UnhandledErrorException
at ReactiveUI.RxApp+<>c__DisplayClass11_0.<.cctor>b__2()
at System.Reactive.Concurrency.Scheduler.Invoke(System.Reactive.Concurrency.IScheduler, System.Action)
at System.Reactive.Concurrency.DispatcherScheduler+<>c__DisplayClass12_0`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].<Schedule>b__0()
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
at System.Windows.Application.RunDispatcher(System.Object)
at System.Windows.Application.RunInternal(System.Windows.Window)
at SourceTree.App.Main()

Like # people like this

For time being, I have installed version 3.4.4 and it's working fine. Thank you @Miro XY for the download link.

Installing 3.4.4 worked for me. In all instances where Sourcetree was crashing for me, the repository already contained several files. So Sourcetree isn't just crashing if you try to clone an empty repo.

I encountered this exact same error just recently as well. I found that all I needed to do was actually commit something to the repository (e.g. a readme to the master branch) in order for Sourcetree not to crash when trying to clone. Initially the repository was brand new and empty, which I guess Sourcetree chokes on.

Thanks for your response Aidan. If I encounter this again, I will give it a try.

Like # people like this

Can confirm when opening a new repository without commits it crashes on version 3.4.6.

Like # people like this

Also confirmed that trying to clone an empty repository does crash 3.4.5 and 3.4.6.

Thanks for posting this solution!

Like # people like this

Hi, good day. I confirmed as said by Atanas Harapov, version 3.4.6 is still crashed when I tried to clone a repo w/o any branches & commits.

I'm a confused newbie. How can I commit to an empty repository when I am unable to clone it?

Like # people like this

Good question, David John Brown.

There are a couple of ways of doing this.

If you created your repository in BitBucket, you can access it by signing in at https://bitbucket.org, find your repository, and create a file in it, for example, use the option to create a default .gitignore file. That one file is enough to get around this bug.

Otherwise, you might have to SSH into your server and use command-line git to commit a file, which is really not easy for a newbie. Which is ironic: the whole point of Sourcetree is to avoid the need to use command-line git!

Hope that helps. And I've no idea how to get the attention of the Atlassian team, but please, for pity's sake, if you're reading this: this silly issue is a huge impediment to people's getting going on Sourcetree. Please, please do the simple fix and stop confusing newbies!

Like # people like this

Thank you, Mark Jeffery. I got round it (after some head scratching) by using Git GUI, which I would prefer to have avoided given that I was following a Sourcetree tutorial!

Like Mark Jeffery likes this

Greetings David, as said by Mark Jeffery, when you create an empty repository BitBucket suggests making an "Initial Commit" with a README.md and/or with .gitignore file, both of them are in buttons in the repo creation form OR in the instructions when you finish the creation of. This is the common workaround I've found in this community. Regards and have a good day!

Thank you, SETS_Insperion. I fell into this trap as I was trying to follow step-by-step a very good tutorial which I was using to try to get to grips with Sourcetree. I hated having to break off from the tutorial to workaround the issue. However I'm back on track now, thanks to the internet and, in particular, to this post.

Same issue using version 3.4.7. Fixed it creating an empty file on the remote repository.

Like # people like this

Fixed it by creating a README file in the Gitlab repo. Thanks, Aidan!

Same problem here using 3.4.8.

Solved by cloning a brand new repo using Visual Studio, copying a file (any file) into the new location on-disk. I could then, successfully open SourceTree on the local copy and Commit/Push.

This has been an open issue since July 2021 - eight months. This should be something very easy to fix. What's up?

As suggested by Aiden:

  • No need to downgrade to a previous version
  • Just commit a file (any file) to your repository and Sourcetree will no longer crash on cloning

Hey, Atlassian folk, could we get a fix for this? It's a strong candidate for a really easy fix:

  • well-defined: just clone a repository with no files in it
  • reproducible: happens every time!
  • recently introduced: it didn't happen in 3.4.4, it does happen in 3.4.5...latest (3.4.6)

Just crashing imposes real costs on users (we have to search the web for a solution, downgrade to an older version and/or work around the issue)... and crashing is not a good look!

Thanks  :)

Still happens in version 3.4.7.

Like # people like this

This crash bug is still alive @Ver.3.4.8 when using other servers ( Gitlab / Gogs / Gitea ) - exactly as OP described - even with non-empty repos.

0 votes

Got the same problem with Sourcetree 3.4.7, did the actions that Miro XY  suggested.

Deleted the folder and use version 3.4.4.

0 votes

Hi, still the same problem in 3.4.7. It's starting to get embarrassing!

Hi everybody, i had faced with same problem and i found there is a error when you make a git clone via console : 

Cloning into 'src'...
warning: You appear to have cloned an empty repository.

 

So please check your repo on empty and if it's empty just add readme throw  web ui

This is my Solution (as a git-Rookie):

  1. Create Repository in Bitbucket
  2. Open Sourctree
  3. In Sourctree: click on Terminal (right, top line)
  4. In the Terminal: use the commands cd, cd.. and dir (with TAB) to navigate to an empty Directory
  5. In the Bitbucket-Repository: copy the clone-command: "git clone https://............./test-repo-02.git
  6. Terminal: paste the command and press Enter
  7. Windows-Explorer: go to the Directory and add e.g. a Text-File
  8. Sourctree: Add a new Tab and Add the Directory
  9. You are ready to commit and push the Repository

Hope this helps someone.

Thx, this help me to resolve.

Hi,

I'm having the same error in version 3.4.6.

I try to clone a repository, paste the URL, checks if it is a Git repository and them crashes the application.

I'm returning to version 3.4.4 as suggested by Miro XY in one of the answers in this thread.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Sourcetree

Bug Fix: Sourcetree for Windows authentication error when updating to app password

Hello Sourcetree users!!! With the recent removal of Bitbucket Cloud account passwords for app passwords (please see our Bitbucket Cloud community post for details on why we made this change for se...

61,828 views 127 27
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you