Adam Grant
Adam Grant

Reputation: 13105

Git is silently failing after push/pull

I'm a one-person IT department managing our company's website and recently recommended they have me set up version control. I've read all the tutorials and have heard everyone else's version of the best workflow, however, I'm starting with a humble setup until I can get this simple workflow operational.

Problem: After setting this up, The push and pull works fine (i.e. it presents no errors), but I don't actually see the changes show up either on my local machine or on the server.

  1. I started by doing a git init to the /var/www/ folder.
  2. Then, I cloned the remote repository via SSH to my local machine.

    At this point, the files from my server show up in my local repository, no problem.

  3. On my local machine, I added a branch to the repo called "development"

  4. Added a new line of text to an HTML doc on my local machine.
  5. Staged and committed the HTML doc on the development branch.
  6. Pushed to the server.

    At this point, the changes do not show up.

  7. On the master branch on the server, I added a line to the html file, a random jumble of text.

  8. Staged and committed the change.
  9. On my local machine, I pulled from the master branch on the remote repository.

Again, no errors. But the changes do not show up. The file on the server and on my local machine reflect the original contents and the respective changes I made on each one.

Upvotes: 2

Views: 116

Answers (1)

mipadi
mipadi

Reputation: 410662

When you push into a remote repository, it only updates the repo's data -- the files don't get checked out/updated. You can solve this by adding a post-receive hook that runs git checkout -f.

Upvotes: 1

Related Questions