Git push command with no apparent effect

Asked

Viewed 392 times

4

A simple GIT question...

I created a repository on the remote server and performed a git remote add (...), git add "files", git commit and git push origin master, on my localhost, so I could connect to the repository and upload the files. Everything went through normally (showed sending the files and the percentage of progress).

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

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

2 answers

3


Marcony looks for the history through the command

git log

and make sure that you are sending to the correct branch because there is more than one. The command to see this is:

git branch

2

If the repository on the server is Bare, that is, it does not have a Working Tree, your files will not be visible directly on the server.

To Working Tree from your repository are the actual files. A repository on a remote git server does not create these files, it only keeps their version information since the repository was created.

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

HEAD        config      description hooks       info        objects     refs

As you can see, the archive files 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 check that the files are created.

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

GIT_WORK_TREE=/path/where/to/checkout git checkout -f

Browser other questions tagged

You are not signed in. Login or sign up in order to post.