Remote Git Repository in document root

Im trying to use git for my website. The website is on our webserver.

mkdir /home/website/public_html
cd /home/website/public_html
git --bare init

Then I go to the local machine and change into the directory where I have my files

  • Merge multiple old commits in git which have already been pushed?
  • Restricting users to a branch on GITHUB
  • Using visual studio 2015, how to Commit only one file?
  • How do I 'overwrite', rather than 'merge', a branch on another branch in Git?
  • What is the alternative to using --process-dependency-links with pip
  • How to make msysgit installation a remote repository
  • git remote rm origin
    git remote add origin
    git push origin master
    Enter passphrase for key '/c/Users/git/.ssh/id_rsa':
    Counting objects: 6, done.
    Delta compression using up to 8 threads.
    Compressing objects: 100% (3/3), done.
    Writing objects: 100% (6/6), 460 bytes, done.
    Total 6 (delta 0), reused 0 (delta 0)
     * [new branch]      master -> master

    But now when I got to my back to my server:

    ls /home/website/public_html
    branches  config  description  HEAD  hooks  info  objects  refs

    Where are my files I pushed to the server? Am I going about this the wrong way? (the only thing in the local folder I pushed from was a readme)

  • SSL certificate rejected trying to access GitHub over HTTPS behind firewall
  • What is the difference between “git init” and “git init --bare”?
  • Phonegap - automatically including correct cordova
  • How to get Git log with short stat in one line?
  • How to use Bitbucket as a maven remote repository?
  • Vagrantfile inside the project repo, good Vagrant workflow?
  • 2 Solutions collect form web for “Remote Git Repository in document root”

    You have created a bare repository on the server. Bare repositories do not have a working area.

    I assume you are trying to use Git for website publishing? See this link for one option. In short:

    • You create 2 repositories on the server. One is a bare repository, just like the one you have already created, but it’s outside of the public_html directory
    • Other is a normal repository inside the public_html directory
    • You create a post-receive hook that updates the repository inside the public_html directory whenever you push to the bare repository

    You have to clone your repository that you created with git –bare init. See git clone.
    For example :

    1) create a repository with git –bare init in a folder on your server

    2) clone that repository somewhere where you want to work with like public_html

    3) after you add something new in your clone folder, use:

    git add .
    git commit -a -m" message for commit "
    git push origin master 

    And to get the code from your repository use:

    git pull origin master 

    and that will merge the code from repository with your local branch

    Git Baby is a git and github fan, let's start git clone.