Fix "could not lock" on git tf checkin

Mar 8, 2013 at 9:48 AM
Hi all,

We've been using GIT TF successfully for various projects (so thank you!) but we have one particular project that ALWAYS gives a "Could not lock" error every time one tries to checkin changes:

git tf checkin --no-metadata
Connecting to TFS...
Checking in to $/tfs_project: 0%
git-tf: Could not lock $/tfs_project
I'm trying to understand why we only get the issue with the one project. I've checked using Visual Studio and the top level folder isn't locked by anyone else. Could this be due to some kind of permission issue on the top level folder or an issue an issue with the files within?

As a side note I fully understand why a lock is necessary and that I am able to overcome this by using the --no-lock option e.g.

git tf checkin --no-metadata --no-lock 
This the workaround we're using at the moment however I'm concern that we could eventually end up with a conflict if two people commit simultaneously so I would like to resolve the problem.

Any insight into the problem/solution gratefully received. Thanks in advance.
Developer
Mar 8, 2013 at 3:08 PM
It's an issue with the files within... one of them has a checkout lock on it. When you try to lock $/tfs_project, it requires that nothing below that point is locked. It's disappointing that we have to be so heavy-handed here.

You can see who has that locked with the TFS Power Tools, using the File Search by Status to see what user / workspace that lock is in.
Mar 8, 2013 at 3:30 PM
@ethomson thanks for the reply, good advice however I've installed the power tools, searched and there are no locks or "No items found" when searching for "All checked out files" so doesn't look like any sub files are locked.