1

I have installed Git and configured it as server in CentOS and Windows as client machine.

And then I made one repo and tried to push changes but failed with error updating the current branch in a non-bare repository is denied and after google search I came to know git config receive.denyCurrentBranch ignore

Then I tried again pushing the changes

  ~/Documents/GitHub/Proj02 (master)
$ git push origin master
Warning: Permanently added '192.168.56.102' (RSA) to the list of known hosts.
git@192.168.56.102's password:
Counting objects: 2, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 229 bytes | 0 bytes/s, done.
Total 2 (delta 1), reused 0 (delta 0)
To ssh://git@192.168.56.102:/home/git/Proj02/
   75a8cb9..484d414  master -> master
~/Documents/GitHub/Proj02 (master)

But I am unable to see the changes at Remote server

[git@centos Proj02]$ git config receive.denyCurrentBranch ignore
[git@centos Proj02]$ ls

Note : Then after I dont see changes at server , so I created one folder in the server repo and push the changes and from the stdout I saw the changes that the files I pushed from client , they got deleted and the recent changes that I was pushed got submitted.

And I am trying to implement a Git server.

How can I see the changes I just pushed?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Raja G
  • 5,973
  • 14
  • 49
  • 82

1 Answers1

1

Make sure that:

  • your server has git 2.3+
  • you have set on that server:

     git config --global receive.denyCurrentBranch updateInstead
    

(See "Push to a non-bare Git repository")

Make sure first that your repo on the server is not a bare repo.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thank you , I will go though the given links. :) – Raja G Apr 17 '16 at 05:02
  • @Raja Sure: make sure of the version of your git (on the server and the client) `git client --version` – VonC Apr 17 '16 at 05:04
  • I have installed latest version only but in centos I have compiled from source as centos official repos have 1.7 version. I think thats not an issue right – Raja G Apr 17 '16 at 05:05
  • @Raja As I mention in the answer, you need git 2.3+ minimum in order to authorize pushing to a non-bare repo. The normal process though (compatible with an old 1.7 git) would be to create bare repo only on the server: you can push to a bare repo. See http://htmlpreview.github.io/?https://github.com/sitaramc/sitaramc.github.com/blob/dce410b2a2804723676db9cabd7bb506b6d9ba05/concepts/bare.html – VonC Apr 17 '16 at 05:06
  • @Raja Of course, with a bare repo, you would not see the files right away (since the repo is bare): you would need to clone it again in order to check the chages (commits) have been pushed – VonC Apr 17 '16 at 05:07
  • @Raja For my solution to work, you need to install (meaning compile) the latest version of git on your CentOS: see https://www.howtoforge.com/how-to-install-the-latest-git-version-on-centos – VonC Apr 17 '16 at 05:08
  • I am using 2.8 , This is the latest Git available. And yes, I have so much to learn. – Raja G Apr 17 '16 at 05:09
  • @Raja Are you using 2.8 on the server side, on the CentOS server? – VonC Apr 17 '16 at 05:10
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/109359/discussion-between-raja-and-vonc). – Raja G Apr 17 '16 at 05:10