What is a good Git strategy for supporting source code at www.hostingcompany.com/~/mysite.com?

This is due to Can't git clone the folder on the server and then edit and click git?

So let the hosting company www.hostingcompany.com

and when i ssh to him i'm in ~ and i will see

 ~/mysite.com ~/any_other_folders 

What is a good git workflow for version controlling all source code in ~/mysite.com and capable of git clone on local PC? And so that I can make changes locally, and then release one line and click on the repo and update all the code on ~/mysite.com ?

sftp using the git repository and then sftp from the local PC to ~/mysite.com good way? I prefer not to do this because it is harder to see if everything is in sync.

0
source share
1 answer

Copy the answer directly from the related question , where you already received it:

You have two options:

  • Make an empty repository ( mysite.com.git ) and a non-bare repository ( mysite.com ). In the bare repository, add post-update to git --git-dir=.../mysite.com pull

    Note that you may want to create a non-bare repository by cloning from bare with the -s flag or after that install .git/objects/info/alternates to avoid copying all the data.

  • Make only one repository and:

    • Detach your head: git checkout master@ {0}

    • Add post-update binding to git merge master

    The reason here is that git refuses to modify the posted branch, but if you drop the branch, you can click. And you can update the working directory from the hook (hook is a script placed in the hooks directory in the repository). You can create a separate branch and check this, or you can use the "detached HEAD" state (as indicated above: git remembers which branch is unloaded by having a special "HEAD" link that points to the branch, but if you check something, this is not a branch, it should indicate a revision directly and called a "separate branch", and since no branch has been checked, you can click on any of them).

  • Make only one repository and:

    • Disable check transition to check.

    • Add the post-update binding to git reset --hard to re-check the branch on click.

    This option is valid for read-only access, because every time you click on the hook, any local changes will be deleted.

If this is just a check and read-only access to it, the second option is a bit more efficient, but if you run some other commands in the working directory, the first one will be more secure (you can erase and recreate the working copy without worrying about the main repo). See also this question .

Edit: The third option has been added.

+2
source

Source: https://habr.com/ru/post/895042/


All Articles