error: could not lock config file filepath/../.git/config :permission denied

These kinds of problems occur when you use sudo to run commands with side effects such as file creation.

It’s quite common to find files and directories in your home directory that are owned by root. In this case it seems your .git/config file is owned by root and thus gives you the permissions error when you try to lock it.

sudo chown bhishan -R .git from the ~/Copy/try directory should fix the permissions issue.

Leave a Comment