1

I created a git bare repo on my linux CentOS server:

/home/git/niels.git.

User git and niels are in group git.

I changed /etc/passwd so home dir of niels is git.

ssh as git to niels.git : push and pull fine.

ssh as niels in the same manner gives:

fatal: '~/niels.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Clearly the repository exists as I can access it as git. Here some rights and group info:

# ls -al /home/git

total 32
drwxrwx--- 4 git  git   4096 Sep 20 22:11 .
drwxr-xr-x 5 root root  4096 Sep 17 14:39 ..
-rwxr----- 1 git  10009  953 Sep 17 14:19 .bash_history
-rwxr----- 1 git  10009   33 Sep 12 22:46 .bash_logout
-rwxr----- 1 git  10009  176 Sep 12 22:46 .bash_profile
-rwxr----- 1 git  git    124 Sep 12 22:46 .bashrc
drwxrw---- 7 git  git   4096 Sep 17 17:19 niels.git
drwxr----- 2 root 10009 4096 Sep 15 22:40 .ssh

# groups niels

niels : niels git 

what am I doing wrong?

Oh BTW I tried all kinds of permission like

chmod -R 740 /home/git

and 766 666 but only with 777 I get the liberating:

Already up-to-date.

But that can't be the way...

Webconstructor
  • 525
  • 2
  • 6
  • 15

1 Answers1

0

But that can't be the way...

Yet it is the way: you are not supposed to access repo under /home/git/ as any other user than 'git'.

ssh opens a secure shell on the remote server (the one which has your upstream repo), and that shell is used with the user you mention in your ssh url: git. That works for accessing /home/git.

Changing the /etc/password isn't enough to change the ownership of that home directory.

You can try a:

sudo chmod 744 -R egit /home/git

(but then the account git will have issue with accessing those same repos)

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • "you are not supposed to access repo under /home/git/ as any other user than 'git'." Ok that I understand. But how does this combine with the idea of sharing a repo: the essence of Git, to work together on the same project? – Webconstructor Sep 21 '13 at 08:53
  • Well I am gonna start from scratch and follow these steps: http://kovshenin.com/2011/howto-remote-shared-git-repository/ thx for your reply VonC – Webconstructor Sep 21 '13 at 09:19
  • @user1762879 you don't have to use different users for your remote repo: one is enough. – VonC Sep 21 '13 at 10:07
  • @user1762879 but with ssh, I prefer using gitolite: http://stackoverflow.com/a/10888358/6309 – VonC Sep 21 '13 at 10:13