Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Project from local bare repository
Project from local bare repository [message #669327] Mon, 09 May 2011 22:55 Go to next message
Drew Decker is currently offline Drew DeckerFriend
Messages: 3
Registered: May 2011
Junior Member
I have a local repository, which is a bare repository. I need to be able to do the same thing I can do in command line in egit (eclipse). via command line, I can clone the repository (bare) add files, etc, commit, and push the changes.

Can egit do this? From my experience and messing around with egit for over 2 hours and reading some of the documentation, I can't seem to get this to work.

Overall question:

How do I create/import a project as/from a bare git repository?
Re: Project from local bare repository [message #669358 is a reply to message #669327] Tue, 10 May 2011 05:20 Go to previous messageGo to next message
Manuel Doninger is currently offline Manuel DoningerFriend
Messages: 119
Registered: October 2010
Senior Member
You can't do this with a bare repository, because there is no working directory. How do you do that with commandline Git?
Re: Project from local bare repository [message #669454 is a reply to message #669327] Tue, 10 May 2011 11:48 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 05/09/2011 06:55 PM, Drew Decker wrote:
> I have a local repository, which is a bare repository. I
> need to be able to do the same thing I can do in command
> line in egit (eclipse). via command line, I can clone the
> repository (bare) add files, etc, commit, and push the
> changes.

You would clone a repo in the Git Repositories view from the bare repo
(don't use Add Local Repo on the bare repo). Then when you create your
project, and instead of using the default location use a subdir of your
cloned repo.

From there, you are able to commit your changes and push them to the
bare repo.

PW



--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Re: Project from local bare repository [message #669534 is a reply to message #669358] Tue, 10 May 2011 15:48 Go to previous messageGo to next message
Drew Decker is currently offline Drew DeckerFriend
Messages: 3
Registered: May 2011
Junior Member
Manuel Doninger wrote on Tue, 10 May 2011 01:20
You can't do this with a bare repository, because there is no working directory. How do you do that with commandline Git?


This is a way to do it with command line:

$ ls -l /repos/testrepo.git/
total 32
drwxr-xr-x 2 git git 4096 2011-05-10 10:40 branches
-rw-r--r-- 1 git git   66 2011-05-10 10:40 config
-rw-r--r-- 1 git git   73 2011-05-10 10:40 description
-rw-r--r-- 1 git git   23 2011-05-10 10:40 HEAD
drwxr-xr-x 2 git git 4096 2011-05-10 10:40 hooks
drwxr-xr-x 2 git git 4096 2011-05-10 10:40 info
drwxr-xr-x 4 git git 4096 2011-05-10 10:40 objects
drwxr-xr-x 4 git git 4096 2011-05-10 10:40 refs

$ pwd
/home/ddecker/Code
ddecker@indigo:~/Code$ git clone git+ssh://git@localhost/repos/testrepo.git
Cloning into testrepo...
warning: You appear to have cloned an empty repository.

$ pwd && ls -a
/home/ddecker/Code/testrepo
.  ..  .git

$ echo "test" > testfile.php

$ ls
testfile.php

$ git add .

$ git commit -m "Initial Commit"
[master (root-commit) e5ef78f] Initial Commit
 Committer: Drew Decker <ddecker@indigo.(none)>
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 testfile.php

$ git push origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 227 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To git+ssh://git@localhost/repos/testrepo.git
 * [new branch]      master -> master

$ pwd && git log
/home/ddecker/Code/testrepo
commit e5ef78fe7c5de737ebefd7acb50efa6185808707
Author: Drew Decker <ddecker@indigo.(none)>
Date:   Tue May 10 10:44:29 2011 -0500

    Initial Commit

$ pwd && git log
/repos/testrepo.git
commit e5ef78fe7c5de737ebefd7acb50efa6185808707
Author: Drew Decker <ddecker@indigo.(none)>
Date:   Tue May 10 10:44:29 2011 -0500

    Initial Commit
Re: Project from local bare repository [message #669535 is a reply to message #669454] Tue, 10 May 2011 15:49 Go to previous message
Drew Decker is currently offline Drew DeckerFriend
Messages: 3
Registered: May 2011
Junior Member
Paul Webster wrote on Tue, 10 May 2011 07:48
On 05/09/2011 06:55 PM, Drew Decker wrote:
> I have a local repository, which is a bare repository. I
> need to be able to do the same thing I can do in command
> line in egit (eclipse). via command line, I can clone the
> repository (bare) add files, etc, commit, and push the
> changes.

You would clone a repo in the Git Repositories view from the bare repo
(don't use Add Local Repo on the bare repo). Then when you create your
project, and instead of using the default location use a subdir of your
cloned repo.

From there, you are able to commit your changes and push them to the
bare repo.

PW



--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


This worked perfectly Smile thanks!

[Updated on: Tue, 10 May 2011 15:49]

Report message to a moderator

Previous Topic:Adding git management to CVS project?
Next Topic:Problems with the Synchronize Workflow
Goto Forum:
  


Current Time: Thu Apr 25 15:26:43 GMT 2024

Powered by FUDForum. Page generated in 0.03274 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top