Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I created a git repo on my vps through root and made it shared so a group of people have the ability to access it:

# mkdir example.git
# cd example.git
# git init --bare --shared=group
Initialized empty shared Git repository in /root/example.git/
# ls
branches  config  description  HEAD  hooks  info  objects  refs
# chgrp -R devs .

Then as a user on my local pc I created a dir and added example.git as the new origin for this git repo. Finally I tried to to make a push to origin:

mkdir bubbles && cd bubbles
bubbles ranuka$ git init
Initialized empty Git repository in /Users/ranuka/Desktop/bubbles/.git/
bubbles ranuka$ ls
bubbles ranuka$ git remote add origin ranuka@000.000.000.000:example.git
bubbles ranuka$ echo "Hello" > readme.txt
bubbles ranuka$ git add readme.txt
bubbles ranuka$ git commit -m "Adding a readme file"
[master (root-commit) 2c89e43] Adding a readme file
1 file changed, 1 insertion(+)
create mode 100644 readme.txt
bubbles ranuka$ git push origin master
ranuka@000.000.000.000's password: 
fatal: 'example.git' does not appear to be a git repository

Confounded by this error since I know example.git is clearly a repo on my vps. I logged in on my vps as 'ranuka' and tried to cd to example.git yet couldn't, but for some reason I could as root.. What gives?

My goal was to create a git repo on my vps that a bunch of users in a certain group could access and make push/pulls to.

EDIT: After running ls -a on root@000.000.000.000 and ranuka@000.000.000.000 These were the results:

.                             example.git
..                            gitosis
ajenti-repo-1.0-1.noarch.rpm  install.log
anaconda-ks.cfg               install.log.syslog
.bash_history                 pgdg-centos93-9.3-1.noarch.rpm
.bash_logout                  .pki
.bash_profile                 repo.git
.bashrc                       .rnd
.cshrc                        .ssh
epel-release-6-8.noarch.rpm   .tcshrc

AND

.  ..  .bash_logout  .bash_profile  .bashrc

So it seems as if root and ranuka are located on different directories with no relationship whatsoever.

share|improve this question
1  
Is there a reason you can't use an out of the box git repo manager? Such as gitlab, or gitorious? –  BigHomie May 15 at 16:09

1 Answer 1

Different users have different home folders.
If you login as root the home is /root.
No other user will be able to access that.

If you login as ranuka the home is (probably) /home/ranuka.
Which does not contain the folder of course since it's in /root.

share|improve this answer
    
Ok I figured that out and created a symlink sudo ln -s /root/example.git /home/ranuka/ and set the origin to ranuka@0.0.0.0:example.git yet it still gives me the same error fatal: 'example.git' does not appear to be a git repository –  user2769651 May 15 at 16:22
1  
Like I've wrote, if you create files in /root no other user will be able to access it. The link doesn't change permissions on that folder. Why don't you initialize the repo with the user you want to use? In his home? Or like @BigHomie wrote use a repo manager? –  faker May 15 at 16:26
    
It seems as if I might have to use a repo manager, yet I still want to figure out whats wrong. Tried a symlink between two users in the same group. ln -s /home/foo/example.git /home/ranuka/ . Still running into the same error when I git remote add origin ranuka@0.0.0.0:repo.git and then try to push. –  user2769651 May 15 at 17:00
    
You really need to learn the permission fundamentals. Users cannot read others users files in their /home. –  faker May 15 at 17:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.