git push command with no apparent effect

4

A simple question from GIT ...

I created a repository on the remote server and ran a git remote add (...), git add "files", git commit and git push origin master, on my localhost so that I could connect to the repository and send the files. Everything went smoothly (showing sending the files and the percentage of progress).

However, when I go to my server, I can not find these files I just pushed. I just type ls -la and it only appears my .git folder, which possibly contains these files that I sent.

When pushing, in the way I did, should the files already be present on the server?

    
asked by anonymous 01.08.2014 / 02:40

2 answers

3

Marcony look for the history using the command

git log

and make sure you are submitting to the correct branch as there are more and one. The command to see this is:

git branch
    
01.08.2014 / 03:32
2

If the repository on the server is bare , that is, it does not have a working tree , its files will not be visible directly on the server.

The working tree of your repository are fact files. A repository on a remote git server does not create these files, it only retains the version information from them since the repository was created.

Normally, the file structure of a git remote server is like this:

HEAD        config      description hooks       info        objects     refs

As you can see, the files in the repository are not visible.

If you want to be absolutely sure that your files have been uploaded to the server, you can clone the repository into a new folder and verify that the files are created.

Depending on your needs, you can also create a post-commit hook and check out your files on the server. The hook could look something like this:

GIT_WORK_TREE=/path/where/to/checkout git checkout -f
    
01.08.2014 / 08:12