0

i'm using git with all repos on network target (\\server1\...). This is the only place where all the data is stored. If i change something i do a commit. That's it. This was ok because i'm the only coder.

Now, we are three coders. I would like to use the current repos as remote repos which could be cloned by each coder to his own network path (we don't work locally).

Is this possible? If it is, what is to do? If i clone a repo (with GitKraken) i'm not able to push a commit. I always get a error like "Push failed - Local push doesn't (yet) support pushing to non-bare repos".

What can i do?

Thanks in advance!

CSharper
  • 5
  • 1
  • 7

2 Answers2

3

You have to make your central repository a bare one—as the error message suggests.

Do git clone --bare <path> to clone the repo under to a bare one.

A bare repository is a repository without a working directory. That makes sense, otherwise a push to that directory would potentially overwrite the changes in the working directory.

See also How to convert a normal Git repository to a bare one?

Community
  • 1
  • 1
Martin Nyolt
  • 4,463
  • 3
  • 28
  • 36
  • Thanks for yout answer. The current repo should not be a working directory. The new, cloned repos should be the working directories. So have i to make the current one a bare one or the cloned ones? – CSharper Sep 06 '16 at 11:52
  • Your "central" repository—that all developers use to synchronise their work—should be the bare one. Thus, you probably want to make your current repo a bare one. – Martin Nyolt Sep 06 '16 at 12:25
  • As a side-note: even if you are working alone, I would never suggest to have the working directory on a network share. Always use the share as a bare repo, and have your working directory as a local copy. – Martin Nyolt Sep 06 '16 at 12:26
  • All right, thanks, i'll try this. To your note: I know, but it is not allowed to do this (company policy) :-( – CSharper Sep 06 '16 at 12:41
0

If you have local PC storage that is distinct from the server share then it is possible to work the multi-way view.

At my work I have a roaming 'home drive', so that is both on my local C: and on some hidden roaming store personal to me. I also have access to the project share drive, where I host the public view repo which has 'master' checked out and its own .git sub-dir repository.

I work locally with my own repo until I have stuff to 'publish'. I have the server repo as a remote and can push my changes to a namespaced branch of my choosing (but not master, as that is checked out!).

I then figuratively close my repo (in my case I have a git gui view), and the swap to accessing the server repo. That server repo also has my own account as a remote, so I could have pulled in the work just completed to a feature branch, and then, if appropriate, merge it. I can then close my access of the server repo, leaving it with master checked out as before.

The hard bit is holding to the social coding guide of always leaving the server at master, and being quick about the swap-over, so minimising any race for access.

Philip Oakley
  • 13,333
  • 9
  • 48
  • 71