On Wed, 29 Aug 2012 01:43:22 -0700 (PDT)
ashu <ashutove...@gmail.com> wrote:

> What can be the reason of this error ?
> ashu@ashu-G41MT-S2P:~/Documents/git-dir/git1$ sudo git init
> [sudo] password for ashu: 
> Initialized empty Git repository
> in /home/ashu/Documents/git-dir/git1/.git/
> ashu@ashu-G41MT-S2P:~/Documents/git-dir/git1$ git commit -m "first
> commit" fatal: Unable to create
> '/home/ashu/Documents/git-dir/git1/.git/index.lock': Permission
> denied ashu@ashu-G41MT-S2P:~/Documents/git-dir/git1$ sudo git commit
> -m "first commit"
The reason is that for some totally unknown reason you first create
your repository as root (and files created in the git's metadata
directory, named ".git", get root:root as its owner/group and
appropriate permissions) and then you're trying to manipulate files in
this directory (`git commit`, in the end, does exactly this) using your
normal user credentials.

There's no sense to initialize *your personal* Git repository as root.
Note that there are really not many things to do on your machine you
need root privileges for; mainly they are limited to package management,
editing system configuration files and (re)starting daemons.


You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to