Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [egit-dev] How to clone an empty remote repo or push without cloning before?

On Wed, Dec 29, 2010 at 05:28, Mark Sofie <mark.sofie@xxxxxxxxx> wrote:
> I have problems pushing a new eclipse project into a remote repository:
>
> 1) I have created a local git repository as described in the Egit getting
> started docs.
> On the remote git server I have created a repository containing only an empty
> file "README".

This is the wrong way to create a remote git repository.

Instead what you want to do is use git init bare:

  mkdir my-project.git
  cd my-project.git
  git init --bare

> If I choose "Team->Push to" on the local repository and select the remote git
> server as target, the final "Push Confirmation" dialog shows:
>  Status: Repo #1 [rejected]
> What is wrong with this procedure?

This is because you created two different projects... one locally in
your Eclipse, and a completely different unrelated project on the
server.  Pushing the Eclipse project to the server project would cause
a loss of the information stored in the server project.  To prevent
wanton data destruction, EGit is stopping you.


> 2) Another problem is that I cannot clone a new eclipse project from a remote
> empty git repository. I think the reason is that the remote repository must
> include a proper .project file.

Probably true.  I don't know that section of EGit well, it might be
unable to clone an empty bare repository.  This is a bug, C Git can
clone an empty bare repository (but with a warning issued to the
user).  EGit should be able to do the same.  However, since the
repository is empty, there won't be any .project file, so we need
extra UI to help the user get the empty local directory added into
their workspace.

-- 
Shawn.


Back to the top