Git push does not update files on the remote server

I installed the git repository on my local computer and as open storage in the linode window. There are no errors when running git push, but I do not see the file on the remote server. The sequence of subsequent commands was lower:

On the remote control:

abhijat@kangaroo :~$ mkdir dev abhijat@kangaroo :~$ cd dev && git init --bare 

By local machine:

 krypton:test abhijat$ git init krypton:test abhijat$ vim app.py krypton:test abhijat$ git init Initialized empty Git repository in /Users/abhijat/dev/test/.git/ krypton:test abhijat$ git add . krypton:test abhijat$ git status # On branch master # # Initial commit # # Changes to be committed: # (use "git rm --cached <file>..." to unstage) # # new file: app.py # krypton:test abhijat$ git commit -m 'test first commit' [master (root-commit) 3bee148] test first commit 1 files changed, 16 insertions(+), 0 deletions(-) create mode 100644 app.py krypton:test abhijat$ git remote add origin abhijat@linode :~/dev krypton:test abhijat$ git push -v origin master Pushing to abhijat@linode :~/dev Counting objects: 2, done. Delta compression using up to 4 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (2/2), 298 bytes, done. Total 2 (delta 1), reused 0 (delta 0) To abhijat@linode :~/dev 01a0e08..2273564 master -> master 

But when I check linode, the file is missing:

 abhijat@kangaroo :~/dev$ ls -ltr total 32 drwxr-xr-x 4 abhijat abhijat 4096 Sep 8 10:17 refs drwxr-xr-x 2 abhijat abhijat 4096 Sep 8 10:17 info drwxr-xr-x 2 abhijat abhijat 4096 Sep 8 10:17 hooks -rw-r--r-- 1 abhijat abhijat 73 Sep 8 10:17 description drwxr-xr-x 2 abhijat abhijat 4096 Sep 8 10:17 branches -rw-r--r-- 1 abhijat abhijat 23 Sep 8 10:17 HEAD -rw-r--r-- 1 abhijat abhijat 66 Sep 8 10:57 config drwxr-xr-x 12 abhijat abhijat 4096 Sep 8 11:03 objects abhijat@kangaroo :~/dev$ find . -name app.py abhijat@kangaroo :~/dev$ 

Did I miss something obvious here? Communication is via ssh and the keys are configured as expected, I can log in without a password. However, the file is not copied to the remote server.

thanks

+4
source share
2 answers

Git does not work on the server side. Files are highly compressed and grouped into chunks, so you cannot find a specific file.

To test your git server, create another clone in a different directory and see if there is app.py.

 git clone abhijat@linode :~/dev dev2 
+4
source

If you want how to click on the repo and update the files , you can create a git hook on the server side to check the files after clicking them. In the git /hooks/ server directory, create a file called post-receive and add the following code:

 #!/bin/sh git --work-tree=/var/www/domain.com --git-dir=/var/repo/site.git checkout -f 

Then give the correct file permissions using chmod +x post-receive

Note: the above code assumes that your git directory and deployed files are in different directories. Update the file depending on how you configured the settings.

More information and a detailed explanation here: https://www.digitalocean.com/community/tutorials/how-to-set-up-automatic-deployment-with-git-with-a-vps

+5
source

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


All Articles