0

So I think I am confused - but for some reason I cannot push or pull to my git repository.

I have a linux web server and have a web folder in /var/www/bcs.net.nz/

I did a git init bcs.git in this folder (I have also tried .git) and then I thought I could do git clone git@bcs.net.nz:bcs.git to clone it on the local machine or git push on the remote machine.

I have also added a git remote add origin git@bcs.net.nz:bcs.git on the remote machine.

After all of that I still cannot push and pull anything. I am a bit stuck.

git add . & git commit -m "initial commit" work fine.

jwknz
  • 6,598
  • 16
  • 72
  • 115

1 Answers1

1

git clone git@bcs.net.nz:bcs.git would mean to clone a (preferably bare repo) which is in /home/git/bcs.git

You could initialize one there, (git init --bare /home/git/bcs.git), and add a post-receive hook (chmod 755 /home/git/bcs.git/hooks/post-receive) which will checkout the code in the live server folder

#!/bin/sh
git --work-tree=/var/www/bcs.net.nz --git-dir=/home/git/bcs.git checkout -f
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • This is starting to make sense - just one thing - is that hook placed from within the bcs.git repo? I am not sure where the .git is? is I have created bcs.git – jwknz Mar 23 '15 at 07:11
  • @JeffKranenburg a bare repo is it own .git, it has no .git since it is the .git. I have edited the answer accordingly. – VonC Mar 23 '15 at 07:12