git sync dev Update to project directory (reprint)

Source: Internet
Author: User

From:http://toroid.org/ams/git-website-howto

The development project code is stored in the local repository. The following describes how to synchronize a local repository modification to a Web site directory by executing the GIT push Web command.

1. First create a local repository:

mkdir website && in/home/ams/website/.git/echo'  Hello, world!. ' >'thehumble beginnings of my web site. "

The local repository contains the relevant code that needs to be synced to the Web site.

2. Remote Repository

Assume that the Web site is built on a remote server. On the remote server, create a mirrored repository:

mkdir website.git &&-- in/home/ams/website.git/

Then, define a post-receive hook file, take advantage of post-receive, detect the latest updates, and synchronize the latest updates to the Web root directory. The contents of the Post-receive file are as follows:

mkdir /var/www/cat > hooks/post-receive#!/bin/shgit_work_tree =/var/www/www.example.org git checkout-chmod +x hooks/post-receive
/var/www/www.example.org: This directory is the Web site root directory


3. Local repository

Add a remote repository path for the local repository and specify the push branch:

ssh://server.example.org/home/ams/website.git$ git push web +master:refs/heads/master

4. To view the remote server Web root directory, you can see the new index.html file.

5. Update operation

In the local repository, execute the following command to update the Web root of the remote server:

git push web

git sync dev Update to project directory (reprint)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.