I was trying to commit files into my source control (Git) as usual, using Xcode 7.0.1 and from a point onwards I keep getting this message, disallowing me to commit changes into my source control:
Anyone know how to resolve this?
When you perform a Git command that edits the index, Git creates a new index. lock file, writes the changes, and then renames the file. The index. lock file indicates to other Git processes that the repository is locked for editing.
Lock the branch by selecting the ... icon next to the branch name and then selecting Lock from the menu. A lock icon will appear next to the branch name. Unlock a locked branch by selecting Unlock from the same menu.
Adding changes to the Index This process is done by the use of git add command. When the changes have been made in the Working Tree/Area. These changes need to be added to the Staging Area for further modification of the file. git add command adds the file in the local repository.
It's just a common issue faced if two or more git operations are done by your system and that generates a lock file.
All you need to do is:
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
If anything you can check this Quora question for more details on what you've faced: https://www.quora.com/Why-do-my-git-operations-often-fail-with-a-lock-error
Hope that helps you guys, and happy coding!
Also make sure the simulator is not running while you are commiting. Close both simulator and Xcode. then restart and try again
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With