📜 ⬆️ ⬇️

Git to upload updated files to the site

I do not know what you use to upload the modified files to the site, but I used to do everything manually. Tedious and foolish work is over, and at some point laziness, as the engine of progress, has taken its toll. Fortunately, by this time I began to deal with the rails, and with them and with other delights of adequate development of web applications, including VCS. At some point, it dawned on me - after all, Git ( Project website , Wikipedia ) already has everything to track changes, why not start using it for uploading. All you need is SSH and an intermediate repository on the same server that is not available to the web server. Actually, as:

Remotely


Create a remote repository:
mkdir -p git/project.git
cd git/project.git/
git init --bare



Locally


Create a local repository:
cd /home/me/project
git init


Enter files that do not need to be synchronized, for rails on macos, I write the following in .gitignore:
.DS_Store
log/*.log
tmp/**/*
config/database.yml


Now you can make the first commit and send everything where it should:
git commit -a -m 'Initial commmit'
git remote add production ssh://me@my.server.ru/home/me/git/project.git
git push production master


')

Remotely

It remains to clone the repository.
git clone /home/me/git/project.git

In the future, when updating locally, you need to make a commit and git push, remotely - git pull

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


All Articles