Search code examples
linuxgitgit-pushgit-clone

Can't find my git repository url


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.


Solution

  • 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