解决方法
1 Close Xcode
2 Open the .git folder in your xcode project folder. The folder is hidden, so you would need to either use terminal to open the directory or the "Go to Folder" option in Finder.
3 Then delete the "index.lock" file. Either through terminal or Finder.
4 Try and commit again.
5 If it fails again, repeat 1 to 3 but commit first with terminal.
If you know what you're doing just typing this command into terminal in the current directory of your project and it should delete the lock file: rm -f .git/index.lock
显示git 目录
在终端输入
defaults write com.apple.finder AppleShowAllFiles TRUE
为了重启Finder应用,输入
killall Finder
http://stackoverflow.com/questions/32990720/the-repository-is-locked-error-while-trying-to-commit-into-source-control点击打开链接