This question has already been answered:
I have a website on a hosting. I want to make it so that with the help of git it was possible to push data from the local machine directly to the hosting, without using gihub, respectively, so that the hosting has the ability to save data (fetch / pull).
PS: On the host that I use, you can use the terminal, right in the browser (the developers tried)
In short, I decided it this way: I created a 2 git repository on the server. One is in the working directory, the other is outside it: First in the usual way:
git init git add . git commit -m "First commit" Second to the directory above:
git --bare init Then added this "bare" ("bare") repository as deleted to the first:
git remote add hub ΠΏΡΡΡ/ΠΊ/bare-ΡΠ΅ΠΏΠΎΠ·ΠΈΡΠΎΡΠΈΡ git push hub master Then, on the local machine, I made ssh access to my hosting account by generating ssh-keygen keys and adding the public key to the authorized_keys file on the server.
Then I copied all the files with the command:
git clone ssh://hostXXXXXXX@servXX.ΠΌΠΎΠΉ-Ρ
ΠΎΡΡΠΈΠ½Π³.ru/home/hostXXXXXXX/ΠΌΠΎΠΉ-Π΄ΠΎΠΌΠ΅Π½/bare-ΡΠ΅ΠΏΠΎΠ·ΠΈΡΠΎΡΠΈΠΉ Then I made the necessary changes and started them in the standard way.
git add . git commit -m "Second commit" git push origin master To copy the data to the working project, simply executed on a server:
git pull hub master That's all!