Uploaded image for project: 'Sourcetree for Windows'
  1. Sourcetree for Windows
  2. SRCTREEWIN-1130

"Force option" if index.lock exists or "Delete index.lock" option

    • Icon: Suggestion Suggestion
    • Resolution: Won't Fix
    • None
    • Git
    • None
    • Win7
    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

      I've recently encountered this problem:

      git -c diff.mnemonicprefix=false -c core.quotepath=false checkout – source/VersionInfo.cs
      fatal: Unable to create 'C:/Projects/xyz/.git/index.lock': File exists.

      If no other git process is currently running, this probably means a
      git process crashed in this repository earlier. Make sure no other git
      process is running and remove the file manually to continue.

      Just not to blame SourceTree : It wasn't his fault

      But I would like to have a little helper button: "Delete index.lock" or "Free lock" or even a Force option might be helpful. Everything I want is remaining in the UI of SourceTree and don't open the stupid Console typing this: >del .git\index.lock.

      Can youo help me?
      Thanks
      Marcel

            [SRCTREEWIN-1130] "Force option" if index.lock exists or "Delete index.lock" option

            use rm -f ./.git/index.lock

            Himaja Kokala added a comment - use rm -f ./.git/index.lock

            I get this every time I try to switch features. Very annoying.

            Craig Muckleston added a comment - I get this every time I try to switch features. Very annoying.

            ivschukin added a comment -

            Wow guys, fix this bug. That's really annoying. Makes ST unusable

            ivschukin added a comment - Wow guys, fix this bug. That's really annoying. Makes ST unusable

            Won't Fix? very nice, thanks. this makes ST unusable.

            vladimir volosunov added a comment - Won't Fix? very nice, thanks. this makes ST unusable.

            Same here, happens to me 90% of the time when I am squashing commits

            Leo Pangan added a comment - Same here, happens to me 90% of the time when I am squashing commits

            tszebeni added a comment -

            This issue makes sourcetree unusable for me. I'm forced to switch using a different tool because of this annoying bug.

            tszebeni added a comment - This issue makes sourcetree unusable for me. I'm forced to switch using a different tool because of this annoying bug.

            I get the index.lock issue multiple times a day when I double-click the branch name in the list in order to check it out. I've tried to chase it down, and it seems that this status git command runs just before the checkout:

            git.exe --no-pager -c color.branch=false -c color.diff=false -c color.status=false -c diff.mnemonicprefix=false -c core.quotepath=false status --porcelain --ignore-submodules=dirty --untracked-files=all

            Then, under 200 milliseconds later the checkout command kicks in while that status command is still performing - and failing because of the index.lock being in use:

            git.exe --no-pager -c color.branch=false -c color.diff=false -c color.status=false -c diff.mnemonicprefix=false -c core.quotepath=false checkout master

            Then 700 milliseconds later the first command is done, releasing the lock. That's why you get the error and when you go and look, the index.lock is not there.

            In the screenshot PID 800 is the status command, and PID 10700 is the checkout.

            Please Atlassian, fix this. Maybe make sure that no two git commands are being invoked simultaneously or something?

            It's driving me crazy! Also, use Sysinternal Procmon when developing desktop apps, you'd be amazed what you'll learn about your app

            Sampsa Lehtonen added a comment - I get the index.lock issue multiple times a day when I double-click the branch name in the list in order to check it out. I've tried to chase it down, and it seems that this status git command runs just before the checkout: git.exe --no-pager -c color.branch=false -c color.diff=false -c color.status=false -c diff.mnemonicprefix=false -c core.quotepath=false status --porcelain --ignore-submodules=dirty --untracked-files=all Then, under 200 milliseconds later the checkout command kicks in while that status command is still performing - and failing because of the index.lock being in use: git.exe --no-pager -c color.branch=false -c color.diff=false -c color.status=false -c diff.mnemonicprefix=false -c core.quotepath=false checkout master Then 700 milliseconds later the first command is done, releasing the lock. That's why you get the error and when you go and look, the index.lock is not there. In the screenshot PID 800 is the status command, and PID 10700 is the checkout. Please Atlassian, fix this. Maybe make sure that no two git commands are being invoked simultaneously or something? It's driving me crazy! Also, use Sysinternal Procmon when developing desktop apps, you'd be amazed what you'll learn about your app

            howellcc added a comment -

            Just thought I'd mention this here as it's been my go-to workaround for a while now. For me, I mostly experience this issue when switching branches by double-clicking on the branch that I want to switch to. But I've found if I right click on that same branch and select "checkout", sourcetree will proceed to switch to that branch as expected, without error.

            Just my observation, and my work around. Hope this helps.

            howellcc added a comment - Just thought I'd mention this here as it's been my go-to workaround for a while now. For me, I mostly experience this issue when switching branches by double-clicking on the branch that I want to switch to. But I've found if I right click on that same branch and select "checkout", sourcetree will proceed to switch to that branch as expected, without error. Just my observation, and my work around. Hope this helps.

            I have the same issue. I would like some sort of indicator that the lock file is still present, it would save me from having to close the error and reclick (which is usually all that it takes...)

            William Jones added a comment - I have the same issue. I would like some sort of indicator that the lock file is still present, it would save me from having to close the error and reclick (which is usually all that it takes...)

            Having the same issue as Robert, Daniel, and Clinton since updating to git 2.5.

            Tim Petermann added a comment - Having the same issue as Robert, Daniel, and Clinton since updating to git 2.5.

            Seeing this constantly (many times a day) since using Git 2.5.3 for Windows.

            mark_gillespie added a comment - Seeing this constantly (many times a day) since using Git 2.5.3 for Windows.

            howellcc added a comment -

            I'm experiencing this as well and quite frequently. When I switch branches and when attempting to merge 1 branch with another. The index.lock file is never there when I look.

            Win 8.1
            Sourcetree 1.6.2
            System Git 2.5.1

            howellcc added a comment - I'm experiencing this as well and quite frequently. When I switch branches and when attempting to merge 1 branch with another. The index.lock file is never there when I look. Win 8.1 Sourcetree 1.6.2 System Git 2.5.1

            VipSaran added a comment -

            Installed 2.5.2 and noticed several times the same error comes, but not subsequently (meaning, when the same branch is tried to be co-d after the error, it works).

            What i also noticed is that an artifact was created in working copy during that branch switching (a <name>.jar was coppied as <name>-0.jar). That file was not there before (in neither of the branches) nor it was in the working copy/staging. Maybe something to keep an eye out for...

            VipSaran added a comment - Installed 2.5.2 and noticed several times the same error comes, but not subsequently (meaning, when the same branch is tried to be co-d after the error, it works). What i also noticed is that an artifact was created in working copy during that branch switching (a <name>.jar was coppied as <name>-0.jar). That file was not there before (in neither of the branches) nor it was in the working copy/staging. Maybe something to keep an eye out for...

            With Git 2.5 this happens a lot if you try to change the branch by double clicking the branch name, but that doesn't seem to be the problem that is adressed in this ticket.

            As a workaround it helped me a lot to update to git for windows 2.5.2.2 and if the problem occurs use the right click option "Checkout <branch>...". Seems to be releated to some timing issues, but is defenitely not worth discussing in this ticket.

            Geißler, Daniel added a comment - With Git 2.5 this happens a lot if you try to change the branch by double clicking the branch name, but that doesn't seem to be the problem that is adressed in this ticket. As a workaround it helped me a lot to update to git for windows 2.5.2.2 and if the problem occurs use the right click option "Checkout <branch>...". Seems to be releated to some timing issues, but is defenitely not worth discussing in this ticket.

            VipSaran added a comment - - edited

            Hapens to me regulary with 2.5 Git. Can't checkout a branch from SourceTree anymore. And, what's worst, there is no index.lock file at all!

            VipSaran added a comment - - edited Hapens to me regulary with 2.5 Git. Can't checkout a branch from SourceTree anymore. And, what's worst, there is no index.lock file at all !

            Sui Huang added a comment -

            I also encounter the same issue frequently with version 1.6.11
            The index.lock file can be generated after trying to pull the changes from remote repository to local, while the changes to be pulled conflicts with local commits.

            Sui Huang added a comment - I also encounter the same issue frequently with version 1.6.11 The index.lock file can be generated after trying to pull the changes from remote repository to local, while the changes to be pulled conflicts with local commits.

            Hi there
            I actually have this issue ALL the time.
            Basically every 2 or 3 commit+push I have to manually delete this file and this is obviously very annoying
            Sourcetree is my only GIT client
            I also never use GIT from the command line so I'm not sure what's wrong
            I'm using the embedded version of GIT (build 1.8.3) and don't have a system one installed
            In case it can help I'm under win7
            Thanks in advance
            Stephane

            Stephane Bertout added a comment - Hi there I actually have this issue ALL the time. Basically every 2 or 3 commit+push I have to manually delete this file and this is obviously very annoying Sourcetree is my only GIT client I also never use GIT from the command line so I'm not sure what's wrong I'm using the embedded version of GIT (build 1.8.3) and don't have a system one installed In case it can help I'm under win7 Thanks in advance Stephane

            Yeah unless it starts to become really common I think this isn't something we'll put in, deleting files like this is potentially dangerous if git changes something in the way it works etc so I'd rather not.

            Steve Streeting (Inactive) added a comment - Yeah unless it starts to become really common I think this isn't something we'll put in, deleting files like this is potentially dangerous if git changes something in the way it works etc so I'd rather not.

            Marcel added a comment -

            No, it isn't really common. Nevertheless it might be a helpful feature for everyone who has other Git apps in place. I mean those ones who tend to crash sometimes

            Setting this feature to Trivial or even close it would be fine if I'm the only guy who faces this problem.
            Thanks anyway
            Marcel

            Marcel added a comment - No, it isn't really common. Nevertheless it might be a helpful feature for everyone who has other Git apps in place. I mean those ones who tend to crash sometimes Setting this feature to Trivial or even close it would be fine if I'm the only guy who faces this problem. Thanks anyway Marcel

            I'm not sure it's really common enough to have an explicit feature for it, do you get this a lot? I can't remember ever seeing it.

            Steve Streeting (Inactive) added a comment - I'm not sure it's really common enough to have an explicit feature for it, do you get this a lot? I can't remember ever seeing it.

              Unassigned Unassigned
              19583e0e53a5 Marcel
              Votes:
              1 Vote for this issue
              Watchers:
              18 Start watching this issue

                Created:
                Updated:
                Resolved: