0

Trying to figure out a weird git mishap -

I have 2 environments:

  1. OS: CentOS7 == Git Version: 2.11.0
  2. OS: Linux Mint == Git Version: 2.11.0

What's happening on Env1 is that when I do a push from Env2 it shows the file(s) I commited on the server as staged. Weirdly the code change it suggests is the previous file state before I pushed. So new files show as deleted if I pushed a new file and existing files have their old code.

I have a .gitattributes file with

* text=auto

inside it as suggested in these posts:

Files showing as modified directly after git clone

Git pull results in "needs update" and files shown as modified

the setup follows this tutorial: https://www.linux.com/learn/how-run-your-own-git-server

and to clone the repo in Env2 (my local) I used: git clone ssh://user@ip.add.ress:/path/to/project

which clones it well enough. I've used: git config core.filemode false to make sure it's not a permissions thing as well as set the files on Env1 to 777

steps I use to commit work:

  1. vim filename.filetype
  2. //make some change
  3. git add filename.filetype
  4. git commit -m "a generic msg"
  5. git push -u origin master

I've also tried the git config core.autocrlf thing to no avail - is there any other way I can debug this or investigate it more specifically? Or better yet - anyone come across and fixed?

Community
  • 1
  • 1
  • Do you mean you push into a non-bare repository and wonder about the behavior? This is expected. I mean that the behavior might be unexpected, as you shouldn't really push into a non-bare repository. – Vampire Feb 07 '17 at 17:12
  • @Vampire the non bare repo uses a bare repo for it's .git origin – SomeAmbigiousUserName Feb 08 '17 at 08:48
  • What do you mean by "for it's .git origin" exactly? – Vampire Feb 08 '17 at 09:13
  • in the tutorial I linked - it tells the user to create a /project/project-1.git which is a bare repo, in your non bare repo you call the bare repo as the origin head – SomeAmbigiousUserName Feb 08 '17 at 09:28
  • So you have the non-bare repo and env1 and env2 are both clones of the bare repo, then you push from env2 to the bare repo and env1 shows the strange behavior? – Vampire Feb 08 '17 at 09:36
  • @Vampire yes yeah :) – SomeAmbigiousUserName Feb 08 '17 at 10:03
  • That is not possible, pushing to one repository cannot in any way influence any other clone without that clone actively retrieving the changes. Please verify that you really push to the bare repo and not to env1 directly. – Vampire Feb 08 '17 at 10:04
  • @Vampire so: I've cloned my non-bare repo on env2 and env1 that uses the bare repo as it's origin. On my env2 I make a change, commit and push, Env1 shows the file as being modified, doing a git diff shows the code before my amendments. unstaging the file and checking it out gets my changes – SomeAmbigiousUserName Feb 08 '17 at 10:06
  • As I said, this is technically not possible except if you leave out information. Please provide your exact command sequence to rebuild the situation. – Vampire Feb 08 '17 at 10:10
  • @Vampire sure will do now – SomeAmbigiousUserName Feb 08 '17 at 10:46
  • Well, taht describes the commit and push. But what about the other repos. Please provide a full MVCE to reproduce the problem. Btw. what does `git config --get-regexp remote` say? – Vampire Feb 08 '17 at 13:13

0 Answers0