What do you do if the file in TFS is locked by som

2019-01-30 22:17发布

Someone left the organisation but before leaving, he locked all the files for an unknown reason.

How do you unlock them all so that the other developers can work?

10条回答
再贱就再见
2楼-- · 2019-01-30 22:33

Have a system administrator reset that users password, log on as that user, unlock all files...

I would think this is the solution to almost all 'someone who is no longer at this organization' questions...

查看更多
时光不老,我们不散
3楼-- · 2019-01-30 22:38

It is better to delete the workspace of that user from the server. example

tf workspace /delete /server:your_tfs_server workspace;username

查看更多
我欲成王,谁敢阻挡
4楼-- · 2019-01-30 22:41

I needed to add /collection:collectionURL otherwise the workspace could not be found:

  • List item

tf loc /lock:none /workspace:WorkspaceName;UserName /collection:collectionURL

查看更多
虎瘦雄心在
5楼-- · 2019-01-30 22:45

Sometimes this is masking an different problem with a completely different application is locked by another user, but you cannot even create a New Folder for the new project you wish to merge into ( target won't allow the creation and incorrectly stating that someone has a file locked in their name) but then you dig deeper and another project is the culprit.

So a completely different project can be the problem with it having files locked by someone else.

查看更多
再贱就再见
6楼-- · 2019-01-30 22:46

This was the only way I resolved this, which involved deleting the user's workspace:

http://2toad.com/Blog/2012/1/27/how-to-manage-tfs-workspaces

If the error message says "The item $/... is locked for check-out by someUser:1 in workspace someMachine123." then I use the command:

tf workspace /delete /server:http://machinename:8080/tfs/DefaultCollection someMachine123;someUser:1

There is just a single space between the collection URL and someMachine123;someUser:1.

Note that I payed attention to the fact that the error message mentioned the user as someUser:1, so I mimicked that in the command. It was not enough to just run the command with someUser only. I'm not sure what the :1 is all about but point being, mimick the error message.

Note the server has to be the fully qualified collection path, which you can find by going to Team Foundation Server Administration Console->Application Tier->Team Project Collections, the bottom pane will show a URL for the collection that is selected in the upper pane.

I also had a problem because I accidentally tried to use plural workspaces instead of just workspace because there is a similar command that is plural.

查看更多
女痞
7楼-- · 2019-01-30 22:47

first you need to have the right to do this. If you have that the easiest is to use TFS sidekicks from attrice http://www.attrice.info/cm/tfs/

查看更多
登录 后发表回答