-1

I am very new to git and I am facing the following issue. I have set up a remote server and local server and I am trying to push changes from the local server into the remote server. The push works fine without any errors but the changes/files that were pushed from the local server are nowhere to be seen in the remote server.

What am I missing.?

EDIT: The steps I am following are as follows:

In the remote server, I initialise the git in a test folder as follows

git init --bare

In the local server, inside a test folder with a few files I do the following steps

git init
git add .
git commit -m "test"
git add origin user@remote_server_ip:/path_to_test_git_folder/
git push origin master

following this I get the below message, which leads me to believe the push is successful

Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 279 bytes | 279.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To 10.0.8.54:srv/git/test.git
   97f4e97..30429fb  HEAD -> master

But the files/changes inside the local server does not show up anywhere on the remote server.

Ash Sharma
  • 470
  • 3
  • 18
  • 2
    Could you explain how are you doing this: commands and steps? To find out what's missing, we need to figure out the current steps. – F.Igor Jun 05 '18 at 04:45
  • Are you checking the correct branch on your remote? – kowsky Jun 05 '18 at 04:48
  • @F.Igor I have added the steps I am following currently – Ash Sharma Jun 05 '18 at 04:55
  • @kowsky I believe I am looking at the correct folder. I even ran a machine wide search to see if the files are turning up elsewhere. – Ash Sharma Jun 05 '18 at 04:56
  • 1
    @AshSharma A branch is not the same thing as a directory. – melpomene Jun 05 '18 at 04:59
  • 1
    Why did you create a bare repo on the server? What you're describing sounds like a bare repository working as intended. – melpomene Jun 05 '18 at 05:01
  • 1
    Possible duplicate of [Difference in a bare and non-bare Git repository](https://stackoverflow.com/questions/24833791/difference-in-a-bare-and-non-bare-git-repository) – phd Jun 05 '18 at 05:41
  • @melpomene I was following an online example to setup git repositories. Thank you for the valuable comments. – Ash Sharma Jun 05 '18 at 05:51

1 Answers1

2

But the files/changes inside the local server does not show up anywhere on the remote server.

Which is expected, considering a bare repo does not have by definition a working tree.

You would need a post-receive hook in order to force a checkout somewhere on your server for the file to show up, as seen here.

/path/to/bare/repo.git/hooks/post-receive

#!/bin/bash
GIT_WORK_TREE=/path/to/workingtree git checkout -f  -- .
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250