I am trying to host a git repo on my VPS. However, I want to place the repo under the user home directory.

Example http://DOMAIN_NAME/~askubuntu/gitrepo.git

I have apache2 installed which allows me to monitor the user files by accessing the above link.

I tried the following:

cd /home/askubuntu/public_html/
mkdir gitrepo.git
git --bare init

The above creates the directory gitrepo.git and adds files and folders for git (branch/ HEAD etc..)

My goal is to have several users clone my repo to their machines and contribute to it:

git clone askubuntu@DOMAIN_NAME:gitrepo.git
git push origin master

Right now if I try cloning the project it returns

fatal: 'gitrepo.git' does not appear to be a git repository

Any suggestions of what is missing, or any recommended tutorial/guide that you can share

Thank you


You made the repository in ~/public_html/gitrepo.git. So, if you use Git over SSH, the path would be relative your home directory:

git clone askubuntu@DOMAIN_NAME:public_html/gitrepo.git

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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