Git / gitolit: repo movement after installation of gitolit

I am in the final stages of git and gitolit. This is the current situation:

enter image description here

+6
source share
2 answers

Gitolite repositories do not have working copies. So, you need to create other repositories with working copies, fix the data and click on managed gitolit. The easiest way to do this is on the server directly. Therefore, in every www do directory:

 cd /home/X/www git init git remote add origin /home/gitolite/repositories/X.git git add . git commit git push origin 

Now you have the data in the repositories, which was the easy part. I assume that the same user account has access to both gitolite repositories and server data (as you said in the chat), which greatly facilitates the problem.

There are no alternatives in the repositories now, so you have two copies of the data. To remove them, this is probably the easiest thing for every site:

 cd /home/X git clone -s /home/gitolite/repositories/X.git www.new mv www www.old mv www.new www rm -r www.old 

(the -s for cloning ensures that the repository /home/X/www/.git will not copy data from /home/gitolite/repositories/X.git ). And finally, you need to install the hook. This has already been explained in this question , but your situation is a bit simpler. Since the data lives on the same server and under the same user, you can simply set the hook after the update to all gitolite repositories containing only:

 #!/bin/sh cd /home/X/www git pull 

If you ever want to move the repositories and the web server to separate servers (which I would recommend, because the web server, if it is facing outward, should be in the "DMZ", and the git server is better on your internal network after another line of firewalls), of course, you will need the ssh trigger described in this other question.

+5
source

I understand what you're saying, so please leave a comment if I'm not in the database, but you need git clone to create an empty repository that you created on your computer, then you can copy the .git directory to your working directory. This should save the remotes.

The process should look something like this:

 git clone gitolite:a.git # Message about copying an empty repo cp -R a/.git/ /your/home/directory/a 

After you copied it, you should install .gitignore , if necessary, and add / commit it, then do git add . and something like git commit -m "initial commit" , then git push origin master and fill in an empty repo.

+1
source

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


All Articles