1

I'm doing a simple git init C:\XXX running from my master machine to be executed on another slave machine. C:\XXX is a path in the slave. The assumption is that it would create a non bare repository as I did not provide a --bare option. Also I looked at the system, global config settings in the slave machine and specifically set the bare = false option in these. But even then after running the git init I can see the local config having bare = true.

From where does the init command takes the bare settings by default?

gustavohenke
  • 40,997
  • 14
  • 121
  • 129
ARUN NAIR
  • 11
  • 1
  • I'm not clear on what the roles of the master machine and the slave machine are here. Is `C:\XXX` accessible from both? Do the two machines have different system or global settings? (For instance, if you ran `git init C:\XXX` on machine A, then it is only the settings in A's configuration files that matter.) – chepner Jun 10 '15 at 18:31
  • I have this jenkins job configured to be run on a slave. The job has a series of git commands using a workspace directory in slave. C:\XXX is the workspace directory in slave. When jenkins executes the git init command it is a creating a bare repository. I tried to display the git config --list before the init and none of the bare settings are set to true but I do the same after the init command and I see one bare=true entry. I also tried directly executing these commands from slave machine command prompt and it does create a non bare repository that way – ARUN NAIR Jun 10 '15 at 18:39
  • what is the global setting for `bare` on the master machine? – Nick Volynkin Jun 11 '15 at 04:30

1 Answers1

0

When you run git init <path> on your master machine, the Git app is run on master. It uses global configs of that machine, where you probably have bare=true.

To solve this you can use one of these options:

  1. Login to slave machine with SSH and run git init <path>
  2. Directly copy a premade .git to selected path on slave. This gives you an option to use tweaked repository. E.g. you can add git hooks.
Nick Volynkin
  • 14,023
  • 6
  • 43
  • 67
  • Got it resolved!! It somehow had to do with the slave machine I created. I updated lot of config files to have bare = false and probably messed up something . So I deleted the slave and created another slave and used the slave.jar that I needed for starting the new one. – ARUN NAIR Jun 12 '15 at 18:07
  • Thank you all for your feedback. Nick -> the git init was being run on the slave machine as the jenkins job was running on the slave and it was using the slave git also as I provided the tool location with slave git path – ARUN NAIR Jun 12 '15 at 18:09
  • @ARUNNAIR oh, I see. Would you mind if I rewrite my answer to include your solution? – Nick Volynkin Jun 12 '15 at 18:37
  • Sure Nick. Please go ahead – ARUN NAIR Jun 15 '15 at 13:55