0

I have worked with CVS, SVN, Mercurial... but everytime I try do something with GIT I seem not to understand its philosophy.

I have a private Rhodecode server, where I wanted to have a copy of a public git repository.

Performed the following steps:

  • I cloned the public repository
  • Copied it to my rhodecode server into an empty git repository
  • Did a git clone on another machine
  • Created a branch and did some modification
  • Commit
  • Push: "Refusing to update branch in a non bare repository"

If I clone as a bare repository I do not have a working copy, so this seems no solution either.

Why am I not able to push my changes to the server ? Is there another working flow for getting a public repo into Rhodecode ?

There are some git options you can change to ignore this error, but I have a feeling this is not a proper solution.

In something like Mercurial this is not problem, but GIT is rather cryptic.

Waldorf
  • 833
  • 2
  • 13
  • 24
  • Why do you need a working copy on your server? – Igal S. Nov 27 '16 at 15:29
  • Using bare repositories really *is* best for nearly every situation, but if you have the rare exception, Git now (since 2.4.0) has `updateInstead` which works a lot like Mercurial (not exactly the same, because it can't, because Mercurial lacks Git's "index", but close enough for most practical purposes). – torek Nov 27 '16 at 16:13
  • Why do you need a working copy on your server? I think this question gave me the answer... probably have to change the version on the server to a bare one, which actually makes sense. Will give it a try. – Waldorf Nov 27 '16 at 16:15

2 Answers2

0

The question from Igal S shined me a light.

There is a lot of confusing information on the internet related to bare and non-bare git repositories. Actually it seems the concept is simple: A bare repository does not have a working copy and is the type that should be on a remote server where you want to push changes.
The soludion was simple:

  • Clone the public repository as bare
  • Copy that into the rhodecode store.

    After this it worked as expected.
Waldorf
  • 833
  • 2
  • 13
  • 24
0

In order to safely exchange information server side, RhodeCode needs to operate on GIT Bare repositories. Server side this is the only way to allow exchange. Client side you simply grab the repositories in non-bare format.

Is there anywhere we as RhodeCode team could put more information so it's more clear to people using this for the first time ?

marcinkuzminski
  • 1,751
  • 14
  • 11