threads / discuss / 17252

gitk doesn't work w/o sudo.

Subject: gitk doesn't work w/o sudo.

## tl;dr

13 messages between Jan 19, 2009 and Jan 20, 2009.

replies: 12people: 6as markdown or json

Dilip M· Jan 19, 2009, 10:16 UTC · lore
Hi,

..I recently install GIT on Ubuntu (hardy) box....I am able to use 'gitk' only If I do 'sudo'. Without 'sudo' it complains 'repository not found'

-- DM
Reece Dunn· Jan 19, 2009, 11:59 UTC · re: Dilip M · lore

Re: gitk doesn't work w/o sudo.

2009/1/19 Dilip M <dilipm79@gmail.com>:
Show 5 quoted lines
> Hi,
>
> ..I recently install GIT on Ubuntu (hardy) box....I am able to use
> 'gitk' only If I do 'sudo'. Without 'sudo' it complains 'repository
> not found'

Who is the owner of the repository directory (and the .git directory) and what are the permissions on the directory? You can run (on the command line from the Terminal program):

   ls -lh directory

to find this out (where directory is the directory you are interested in) and run:

   sudo chown user -R directory

to change ownership of that directory (and all of its content) to the specified user (i.e. the one you are currently logged in as). This will make it so that you own that directory and can make changes to it. This should allow you to run gitk without using sudo.

HTH,
- Reece
Dilip M· Jan 19, 2009, 14:37 UTC · re: Reece Dunn · lore

Re: gitk doesn't work w/o sudo.

On Mon, Jan 19, 2009 at 5:29 PM, Reece Dunn <msclrhd@googlemail.com> wrote:
Show 22 quoted lines
> 2009/1/19 Dilip M <dilipm79@gmail.com>:
>> Hi,
>>
>> ..I recently install GIT on Ubuntu (hardy) box....I am able to use
>> 'gitk' only If I do 'sudo'. Without 'sudo' it complains 'repository
>> not found'
>
> Who is the owner of the repository directory (and the .git directory)
> and what are the permissions on the directory? You can run (on the
> command line from the Terminal program):
>
>   ls -lh directory
>
> to find this out (where directory is the directory you are interested
> in) and run:
>
>   sudo chown user -R directory
>
> to change ownership of that directory (and all of its content) to the
> specified user (i.e. the one you are currently logged in as). This
> will make it so that you own that directory and can make changes to
> it. This should allow you to run gitk without using sudo.

Even I suspected that it may be related to some permission and checked them...But I couldn't find the actual cause.

dm-laptop:~/repos/atria> id -a uid=1000(dm) gid=1000(dm) groups=4(adm),20(dialout),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),107(fuse),109(lpadmin),115(admin),1000(dm)

dm-laptop:~/repos/atria> ls -lh .git/ total 44K drwxr-xr-x 2 dm dm 4.0K 2009-01-18 23:24 branches -rw-r--r-- 1 dm dm 256 2009-01-18 23:28 config -rw-r--r-- 1 dm dm 58 2009-01-18 23:24 description -rw-r--r-- 1 dm dm 23 2009-01-18 23:28 HEAD drwxr-xr-x 2 dm dm 4.0K 2009-01-18 23:24 hooks -rw-r--r-- 1 dm dm 3.8K 2009-01-18 23:28 index drwxr-xr-x 2 dm dm 4.0K 2009-01-18 23:24 info drwxr-xr-x 3 dm dm 4.0K 2009-01-18 23:28 logs drwxr-xr-x 4 dm dm 4.0K 2009-01-18 23:24 objects -rw-r--r-- 1 dm dm 94 2009-01-18 23:28 packed-refs drwxr-xr-x 5 dm dm 4.0K 2009-01-18 23:28 refs

'dm' is a user I created while installing Ubuntu.

dm-laptop:~/repos/atria> ls -l `which gitk` -rwxr-xr-x 1 root root 237778 2008-04-08 22:31 /usr/bin/gitk dm-laptop:~/repos/atria>

-- DM
Brian Foster· Jan 20, 2009, 08:12 UTC · re: Dilip M · lore

Re: gitk doesn't work w/o sudo.

On Monday 19 January 2009 15:37:06 Dilip M wrote:
Show 13 quoted lines
> On Mon, Jan 19, 2009 at 5:29 PM, Reece Dunn <msclrhd@googlemail.com> wrote:
> > 2009/1/19 Dilip M <dilipm79@gmail.com>:
> >> ..I recently install GIT on Ubuntu (hardy) box....I am able to use
> >> 'gitk' only If I do 'sudo'. Without 'sudo' it complains 'repository
> >> not found'
> >
> > Who is the owner of the repository directory (and the .git directory)
> > and what are the permissions on the directory?  [ ... ]
> 
> dm-laptop:~/repos/atria> id -a
> uid=1000(dm) gid=1000(dm)  [ ... ]
> dm-laptop:~/repos/atria> ls -lh .git/
>[... all looks Ok ...]
 repeating Reece's question, what is the permissions/owner
 _of_the_directory_which_contains_ the ‘.git/’ directory?
 I can reproduce this behaviour (git 1.6.0.4) simply by
 denying myself search (née execute) permission on that
 directory, for entirely obvious reasons.
cheers!
	-blf-
-- 
“How many surrealists does it take to   | Brian Foster
 change a lightbulb? Three. One calms   | somewhere in south of France
 the warthog, and two fill the bathtub  |   Stop E$$o (ExxonMobil)!
 with brightly-coloured machine tools.” |      http://www.stopesso.com
Dilip M· Jan 20, 2009, 16:51 UTC · re: Brian Foster · lore

Re: gitk doesn't work w/o sudo.

On Tue, Jan 20, 2009 at 1:42 PM, Brian Foster <brian.foster@innova-card.com> wrote:

Show 20 quoted lines
> On Monday 19 January 2009 15:37:06 Dilip M wrote:
>> On Mon, Jan 19, 2009 at 5:29 PM, Reece Dunn <msclrhd@googlemail.com> wrote:
>> > 2009/1/19 Dilip M <dilipm79@gmail.com>:
>> >> ..I recently install GIT on Ubuntu (hardy) box....I am able to use
>> >> 'gitk' only If I do 'sudo'. Without 'sudo' it complains 'repository
>> >> not found'
>> >
>> > Who is the owner of the repository directory (and the .git directory)
>> > and what are the permissions on the directory?  [ ... ]
>>
>> dm-laptop:~/repos/atria> id -a
>> uid=1000(dm) gid=1000(dm)  [ ... ]
>> dm-laptop:~/repos/atria> ls -lh .git/
>>[... all looks Ok ...]
>
>  repeating Reece's question, what is the permissions/owner
>  _of_the_directory_which_contains_ the '.git/' directory?
>  I can reproduce this behaviour (git 1.6.0.4) simply by
>  denying myself search (née execute) permission on that
>  directory, for entirely obvious reasons.
It's the same issue....Any ENV variable I can set to debug this...?

dm-laptop:~/repos/atria> id -a uid=1000(dm) gid=1000(dm) groups=4(adm),20(dialout),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),107(fuse),109(lpadmin),115(admin),1000(dm)

dm-laptop:~/repos/atria> ls -ld .git drwxr-xr-x 8 dm dm 4096 2009-01-19 22:34 .git

dm-laptop:~/repos/atria> ls -la .git total 68 drwxr-xr-x 8 dm dm 4096 2009-01-19 22:34 . drwxr-xr-x 6 dm dm 4096 2009-01-18 23:28 .. drwxr-xr-x 2 dm dm 4096 2009-01-18 23:24 branches -rw-r--r-- 1 dm dm 20 2009-01-19 22:28 COMMIT_EDITMSG -rw-r--r-- 1 dm dm 256 2009-01-18 23:28 config -rw-r--r-- 1 dm dm 58 2009-01-18 23:24 description -rw-r--r-- 1 dm dm 89 2009-01-19 20:15 FETCH_HEAD -rw-r--r-- 1 dm dm 23 2009-01-19 21:49 HEAD drwxr-xr-x 2 dm dm 4096 2009-01-18 23:24 hooks -rw-r--r-- 1 dm dm 5280 2009-01-19 22:28 index drwxr-xr-x 2 dm dm 4096 2009-01-19 22:34 info drwxr-xr-x 3 dm dm 4096 2009-01-19 22:34 logs drwxr-xr-x 4 dm dm 4096 2009-01-19 22:34 objects -rw-r--r-- 1 dm dm 41 2009-01-19 20:15 ORIG_HEAD -rw-r--r-- 1 dm dm 153 2009-01-19 22:34 packed-refs drwxr-xr-x 5 dm dm 4096 2009-01-18 23:28 refs

dm-laptop:~/repos/atria> umask 22

-- DM
Matthieu Moy· Jan 20, 2009, 17:10 UTC · re: Dilip M · lore

Re: gitk doesn't work w/o sudo.

"Dilip M" <dilipm79@gmail.com> writes:
Show 7 quoted lines
>>  repeating Reece's question, what is the permissions/owner
>>  _of_the_directory_which_contains_ the '.git/' directory?
>>  I can reproduce this behaviour (git 1.6.0.4) simply by
>>  denying myself search (née execute) permission on that
>>  directory, for entirely obvious reasons.
>
> It's the same issue....
You didn't answer the question.
> Any ENV variable I can set to debug this...?
GIT_TRACE can help.
-- 
Matthieu
Dilip M· Jan 20, 2009, 17:35 UTC · re: Matthieu Moy · lore

Re: gitk doesn't work w/o sudo.

On Tue, Jan 20, 2009 at 10:40 PM, Matthieu Moy <Matthieu.Moy@imag.fr> wrote:
Show 11 quoted lines
> "Dilip M" <dilipm79@gmail.com> writes:
>
>>>  repeating Reece's question, what is the permissions/owner
>>>  _of_the_directory_which_contains_ the '.git/' directory?
>>>  I can reproduce this behaviour (git 1.6.0.4) simply by
>>>  denying myself search (née execute) permission on that
>>>  directory, for entirely obvious reasons.
>>
>> It's the same issue....
>
> You didn't answer the question.
Sorry..I read it for .git directory...

.git's parent directory is owned by user who us issuing gitk command and permisssion bit of 755 is set.

dm-laptop:~/repos/atria> ls -ld . drwxr-xr-x 6 dm dm 4096 2009-01-18 23:28 .

dm-laptop:~/repos/atria> ls -ld .git/ drwxr-xr-x 8 dm dm 4096 2009-01-20 22:22 .git/

>> Any ENV variable I can set to debug this...?
>
> GIT_TRACE can help.

I tried with that but it didn't help for gitk. But sure, it helps with git command(s).

-- DM
Reece Dunn· Jan 20, 2009, 18:00 UTC · re: Dilip M · lore

Re: gitk doesn't work w/o sudo.

2009/1/20 Dilip M <dilipm79@gmail.com>:
Show 24 quoted lines
> On Tue, Jan 20, 2009 at 10:40 PM, Matthieu Moy <Matthieu.Moy@imag.fr> wrote:
>> "Dilip M" <dilipm79@gmail.com> writes:
>>
>>>>  repeating Reece's question, what is the permissions/owner
>>>>  _of_the_directory_which_contains_ the '.git/' directory?
>>>>  I can reproduce this behaviour (git 1.6.0.4) simply by
>>>>  denying myself search (née execute) permission on that
>>>>  directory, for entirely obvious reasons.
>>>
>>> It's the same issue....
>>
>> You didn't answer the question.
>
> Sorry..I read it for .git directory...
>
> .git's parent directory is owned by user who us issuing gitk command
> and permisssion bit of 755 is set.
>
>>> Any ENV variable I can set to debug this...?
>>
>> GIT_TRACE can help.
>
> I tried with that but it didn't help for gitk. But sure, it helps with
> git command(s).

So can you run git commands that modify the git tree, e.g. git add? If these are failing, that may explain why gitk is failing, and you can use GIT_TRACE.

Also, do you know what commands are being executed by gitk that are causing the failure you are experiencing?

Or... is your ENV (e.g. your PATH) the same for dm and root? In particular, can they find the git commands? This would also be visible by not being able to do things like `git log` (or, if it is an issue with the deprecation of the `git-foo`-style command invocation, is the GIT_EXEC_PATH set to point to the correct location and does dm have the rights to execute it -- that is, is the x bit set for the GIT_EXEC_PATH directory, as per http://www.digizenstudio.com/blog/2008/11/09/weird-git-gui-startup-problem/?).

What error message are you getting from gitk? Is it possible to debug gitk to find out what command is being executed and what error code/exception it is returning/throwing?

- Reece
Johannes Schindelin· Jan 20, 2009, 17:16 UTC · re: Dilip M · lore

Re: gitk doesn't work w/o sudo.

Hi,
On Tue, 20 Jan 2009, Dilip M wrote:
Show 24 quoted lines
> On Tue, Jan 20, 2009 at 1:42 PM, Brian Foster
> <brian.foster@innova-card.com> wrote:
> > On Monday 19 January 2009 15:37:06 Dilip M wrote:
> >> On Mon, Jan 19, 2009 at 5:29 PM, Reece Dunn <msclrhd@googlemail.com> wrote:
> >> > 2009/1/19 Dilip M <dilipm79@gmail.com>:
> >> >> ..I recently install GIT on Ubuntu (hardy) box....I am able to use
> >> >> 'gitk' only If I do 'sudo'. Without 'sudo' it complains 'repository
> >> >> not found'
> >> >
> >> > Who is the owner of the repository directory (and the .git directory)
> >> > and what are the permissions on the directory?  [ ... ]
> >>
> >> dm-laptop:~/repos/atria> id -a
> >> uid=1000(dm) gid=1000(dm)  [ ... ]
> >> dm-laptop:~/repos/atria> ls -lh .git/
> >>[... all looks Ok ...]
> >
> >  repeating Reece's question, what is the permissions/owner
> >  _of_the_directory_which_contains_ the '.git/' directory?
> >  I can reproduce this behaviour (git 1.6.0.4) simply by
> >  denying myself search (née execute) permission on that
> >  directory, for entirely obvious reasons.
> 
> It's the same issue....Any ENV variable I can set to debug this...?

I'd try running it with strace, and then search the output for stat() calls involving <something>/.git.

Ciao, Dscho

Dilip M· Jan 20, 2009, 18:20 UTC · re: Johannes Schindelin · lore

Re: gitk doesn't work w/o sudo.

On Tue, Jan 20, 2009 at 10:46 PM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:

> 'd try running it with strace, and then search the output for stat()
> calls involving <something>/.git.
Seems like we are almost there....here is the log..

dm-laptop:~/repos/atria> grep gitk /tmp/gitk_1.log execve("/usr/bin/gitk", ["/usr/bin/gitk"], [/* 37 vars */]) = 0 open("/usr/bin/gitk", O_RDONLY) = 3 execve("/usr/bin/wish8.4", ["/usr/bin/wish8.4", "/usr/bin/gitk", "--"], [/* 37 vars */]) = 0 stat("/usr/bin/gitk", {st_mode=S_IFREG|0755, st_size=237778, ...}) = 0 open("/usr/bin/gitk", O_RDONLY) = 6 lstat("/usr/share/gitk", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 lstat("/usr/share/gitk/lib", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 lstat("/usr/share/gitk/lib/msgs", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 access("/usr/share/gitk/lib/msgs/en_in.msg", F_OK) = -1 ENOENT (No such file or directory) <====== lstat("/usr/share/gitk", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 lstat("/usr/share/gitk/lib", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 lstat("/usr/share/gitk/lib/msgs", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 access("/usr/share/gitk/lib/msgs/en.msg", F_OK) = -1 ENOENT (No such file or directory) <====== stat("/home/dm/.gitk", {st_mode=S_IFREG|0644, st_size=683, ...}) = 0 open("/home/dm/.gitk", O_RDONLY) = 6 writev(5, [{"\22\0\7\0\16\0@\3\'\0\0\0\37\0\0\0\10NG\0\4\0\0\0gitk\20"..., 48}], 1) = 48 writev(5, [{"\22\0\7\0\16\0@\3(\1\0\0\37\1\0\0\10AME\4\0\0\0gitk\22"..., 112}], 1) = 112

dm-laptop:~/repos/atria> ls -l /usr/share/gitk/lib/msgs/en_in.msg ls: cannot access /usr/share/gitk/lib/msgs/en_in.msg: No such file or directory

But how is it working when  I do 'sudo'..
-- DM
Johannes Schindelin· Jan 20, 2009, 21:10 UTC · re: Dilip M · lore

Re: gitk doesn't work w/o sudo.

Hi,
On Tue, 20 Jan 2009, Dilip M wrote:
Show 35 quoted lines
> On Tue, Jan 20, 2009 at 10:46 PM, Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
> > 'd try running it with strace, and then search the output for stat()
> > calls involving <something>/.git.
> 
> Seems like we are almost there....here is the log..
> 
> dm-laptop:~/repos/atria> grep gitk /tmp/gitk_1.log
> execve("/usr/bin/gitk", ["/usr/bin/gitk"], [/* 37 vars */]) = 0
> open("/usr/bin/gitk", O_RDONLY)         = 3
> execve("/usr/bin/wish8.4", ["/usr/bin/wish8.4", "/usr/bin/gitk",
> "--"], [/* 37 vars */]) = 0
> stat("/usr/bin/gitk", {st_mode=S_IFREG|0755, st_size=237778, ...}) = 0
> open("/usr/bin/gitk", O_RDONLY)         = 6
> lstat("/usr/share/gitk", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
> lstat("/usr/share/gitk/lib", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
> lstat("/usr/share/gitk/lib/msgs", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
> access("/usr/share/gitk/lib/msgs/en_in.msg", F_OK) = -1 ENOENT (No
> such file or directory)  <======
> lstat("/usr/share/gitk", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
> lstat("/usr/share/gitk/lib", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
> lstat("/usr/share/gitk/lib/msgs", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
> access("/usr/share/gitk/lib/msgs/en.msg", F_OK) = -1 ENOENT (No such
> file or directory)       <======
> stat("/home/dm/.gitk", {st_mode=S_IFREG|0644, st_size=683, ...}) = 0
> open("/home/dm/.gitk", O_RDONLY)        = 6
> writev(5, [{"\22\0\7\0\16\0@\3\'\0\0\0\37\0\0\0\10NG\0\4\0\0\0gitk\20"...,
> 48}], 1) = 48
> writev(5, [{"\22\0\7\0\16\0@\3(\1\0\0\37\1\0\0\10AME\4\0\0\0gitk\22"...,
> 112}], 1) = 112
> 
> dm-laptop:~/repos/atria> ls -l /usr/share/gitk/lib/msgs/en_in.msg
> ls: cannot access /usr/share/gitk/lib/msgs/en_in.msg: No such file or directory
> 
> But how is it working when  I do 'sudo'..
Let's find out.  You can run the strace with sudo, too.
I bet it uses another git.

Ciao, Dscho

Jing Xue· Jan 19, 2009, 14:48 UTC · re: Dilip M · lore

Re: gitk doesn't work w/o sudo.

On Mon, Jan 19, 2009 at 03:46:41PM +0530, Dilip M wrote:
Show 5 quoted lines
> Hi,
> 
> ..I recently install GIT on Ubuntu (hardy) box....I am able to use
> 'gitk' only If I do 'sudo'. Without 'sudo' it complains 'repository
> not found'
Do you have a 0027 umask?
http://www.digizenstudio.com/blog/2008/11/09/weird-git-gui-startup-problem/
HTH.
-- 
Jing Xue
Dilip M· Jan 19, 2009, 15:35 UTC · re: Jing Xue · lore

Re: gitk doesn't work w/o sudo.

On Mon, Jan 19, 2009 at 8:18 PM, Jing Xue <jingxue@digizenstudio.com> wrote:
Show 10 quoted lines
> On Mon, Jan 19, 2009 at 03:46:41PM +0530, Dilip M wrote:
>> Hi,
>>
>> ..I recently install GIT on Ubuntu (hardy) box....I am able to use
>> 'gitk' only If I do 'sudo'. Without 'sudo' it complains 'repository
>> not found'
>
> Do you have a 0027 umask?
>
> http://www.digizenstudio.com/blog/2008/11/09/weird-git-gui-startup-problem/

Mine is dm-laptop:~> umask 22

So, that's not a issue.
-- DM

← back to recent threads