In our Ubuntu Server we are able to clone as Nginx user in /usr/share/nginx/www
that has www-data:www
-data ownership getting a warning as
” warning: unable to access '/root/.config/git/attributes': Permission denied”
We are executing the command as sudo -u www-data git clone <repo>.
With sudo we are getting this warning otherwise its working fine.
We are able to clone as root user and there is no issue.
.gitconfig is located in only root and please see the contents:
root@geo:~# cat /root/.gitconfig
[user]
name = pc_user
email = [email protected]
root@geo:~#
Can anyone please help us on it.
We tried various option like manually created /root/.config/
directly and changed permission etc.. but nothing is working. Can anyone please help me on it.
Also please see this:
root@geo:/setup/test# ll /setup/
total 16
drwxr-xr-x 4 www-data www-data 4096 Oct 9 00:14 ./
drwxr-xr-x 24 root root 4096 Oct 9 00:14 ../
drwxr-xr-x 3 www-data www-data 4096 Oct 9 00:14 test/
root@geo:/setup/test# sudo -u www-data git clone -v git@....../test.git
Cloning into 'test'...
remote: Counting objects: 8323, done.
remote: Compressing objects: 100% (6459/6459), done.
remote: Total 8323 (delta 1543), reused 8241 (delta 1500)
Receiving objects: 100% (8323/8323), 39.85 MiB | 19.52 MiB/s, done.
Resolving deltas: 100% (1543/1543), done.
Checking connectivity... done.
warning: unable to access '/root/.config/git/attributes': Permission denied
So it seems an issue with git setup. Can any one please guide us.
I am using this setup on an Ubuntu 14.04. When I do the same setup in another Ubuntu 12.04 its perfectly working fine.
Also I done this:
Created an user geopc and added to sudoers list and when we logged as geopc user and do this command sudo -u www-data git clone -v git@....../test.git
its working perfectly.
So the issue is when we directly logged as root user in Ubuntu 14.04 and do clone as sudo -u www-data git clone
this warning comes. But its not in Ubuntu 12.04.
We are using git version 1.9.1 on Ubuntu 14.04 we also upgraded git to version 2.1.1 but same.
@mu is right. This is an issue of your the HOME environment variable of user
root
being passed to the script instead of userwww-data
's HOME environment variable.You just need to add the -H switch to the sudo command though, so it's fairly easy:
I think the
HOME
variable is set up incorrectly.From google group thread,
You just need to restart your stash instance using user other then root. Typically, user would be same as you have used at the time of installation.
e.g. atlstash
Doing this will set your HOME variable as /home/atlstash and resolve your issue