Git to a Web-server : How To Set remote git server to automatically merge the branch after pushing?

First of all, im new to Git and Git hooks. Here’s what im trying to do… I want to create a local git repository where I’ll work on my website. Then, I want to setup a git repository in my webserver and push the changes directly from my machine to the server using git. For this, what is the best path?

  • I followed some online guides and did this…
  • Initiated a repository on the remote server.
  • Initiated a repository on my local machine
  • Made a commit
  • Switched to a different branch (Can’t push the master branch to the server (If I can, its a lot easy))
  • Pushed that branch to the server
  • Logged into the server and merged the branch into the master from within it

My questions are,
Is this the best way to do the job?
If it is, can I do the merging part using hooks automatically? (How to do it? Im new to hooks)

  • Set debuild/dpkg to always ignore .git directories
  • How do a use --relative with git format-patch?
  • Git - branch name same as a prefix of existing commit hash
  • Unable to perform git-svn clone on a sub-repository requiring AD authentication
  • Getting started with git-am
  • converting git branch to git tag
  • Find the branch point of any specific commit
  • Git: continuous integration without rebase chaos
  • Git - Moving the .git directory to another drive, keep the source code where it is
  • Git: 'Master cannot be resolved to branch' after merge
  • git-tfs starting from git
  • Does cf push respect the use of .gitignore?
  • One Solution collect form web for “Git to a Web-server : How To Set remote git server to automatically merge the branch after pushing?”

    Reading your question and the comment – the problem is with the way you initialized the repository on your server.

    On your server you need to initialize a bare repository, using the following command:

    git init --bare

    That will fix the error you got when pushing to the server.

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