Git uses a network disk as a version repository for remote synchronization [to be verified]

Source: Internet
Author: User
Tags virtual environment

How can git achieve remote synchronization without using remote repositories such as GitHub?

Submit the code before work. After gOing hOme, sync the code to continue development and submission. The next day, the company will continue ......

Here is an experiment: using the directory synchronization function of the online storage, we create a "pseudo remote repository ".

Take Kingsoft disk as an example:

Step 1.
Find a local directory as a "remote repository". Suppose we use E: \ kuaipan \ Phalcon as the remote repository, then drag the Directory into the USB flash drive, right-click the directory in the client to enable synchronization.

Step 2.
Create a bare version library. According to git rules, only the bare version library can accept git push/pull requests. So we perform this operation (in the cygwin Virtual Environment ):

cd e:/kuaipan/phalcongit init --bare

Step 3.
Create a local version library. Assume that it is created in E:/workspace/phalcon_local.

cd e:/workspacegit clone e:/kuaipan/phalcon phalcon_local

Step 4.
Develop and submit

cd e:/workspace/phalcon_localtouch index.htmlgit add . && git commit -m "add index.html"git push e:/kuaipan/phalcon master

We created an index.html file in the worker work area and submitted it to the local repository (GIT commit). Then we pushed the local repository to the "remote repository" (GIT push ).

Step 5.
If we get home, we open the fast disk and synchronize the directory Phalcon in the fast disk to the local disk, which is equivalent to copying the remote database of the company. Assume that the directory is synchronized to D:/kuaipan/Phalcon.
Then go to the Workspace

cd d:/workspacegit clone d:/kuaipan/phalcon phalcon_localcd phalcon_local......git add . && git commit -m "---over---"git push d:/kuaipan/phalcon

We finished some work at home and finally pushed it to the remote warehouse. Some changes have taken place in the remote warehouse and will be automatically synchronized to the fast disk.

Step 6.
Go to the company the next day and repeat Step 5 for similar operations.

Git uses a network disk as a version repository for remote synchronization [to be verified]

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.