0

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 [email protected]: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 [email protected]'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 [email protected] and [email protected] 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.

1
  • 1
    Is there a reason you can't use an out of the box git repo manager? Such as gitlab, or gitorious? Commented May 15, 2014 at 16:09

1 Answer 1

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.

4
  • Ok I figured that out and created a symlink sudo ln -s /root/example.git /home/ranuka/ and set the origin to [email protected]:example.git yet it still gives me the same error fatal: 'example.git' does not appear to be a git repository Commented May 15, 2014 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? Commented May 15, 2014 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 [email protected]:repo.git and then try to push. Commented May 15, 2014 at 17:00
  • You really need to learn the permission fundamentals. Users cannot read others users files in their /home. Commented May 15, 2014 at 17:08

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.