Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6865241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:01:03+00:00 2026-05-27T03:01:03+00:00

Today I signed up for github, and converted an existing filesystem into a git

  • 0

Today I signed up for github, and converted an existing filesystem into a git repo using the technique described here:

http://crashingdaily.wordpress.com/2009/09/02/initing-a-new-remote-git-repository-with-existing-files/

Most importantly (I think) it involved this line:

git --bare init

I then followed the rest of github.com’s setup tutorials (this was part of that) and was done. The existing filesystem was within Dropbox, so I performed the same setup on the two other machines that use the filesystem (now a git repo).

Tonight I tried to get JGit to add a file, commit it and then push it. Here’s the gist of the code up until the point it breaks:

FileRepositoryBuilder builder = new FileRepositoryBuilder();
        Repository repository = builder.setGitDir(new File("path/to/my/repo"))
          .readEnvironment() // scan environment GIT_* variables
          .findGitDir() // scan up the file system tree
          .build();

    Git git = new Git(repository);
    AddCommand add = git.add();
    try{
        add.addFilepattern("PlayState.as").call();`

This is basically taken verbatim from a JGit tutorial, incidentally. It throws an exception at that last quoted line and states:

org.eclipse.jgit.errors.NoWorkTreeException: Bare Repository has neither a working tree, nor an index
at org.eclipse.jgit.lib.Repository.getIndexFile(Repository.java:838)
at org.eclipse.jgit.lib.Repository.lockDirCache(Repository.java:886)
at org.eclipse.jgit.api.AddCommand.call(AddCommand.java:136)
at flipa.FLIPAGame.writeToFlixel(FLIPAGame.java:77)
at flipa.FLIPAGame.main(FLIPAGame.java:58)

Now, I’m not saying it’s unreasonable to claim that, because truth be told I am not the best friend of version control. I get that a bare repo is one with just git in and no other files, but it seems to me that now it has files in it. I’ve already manually added, committed and pushed to github using git from Terminal. So I can’t immediately see why it won’t even recognise the repo.

Any takers?

EDIT – For clarification, killing off this repo is no big deal if someone can propose another solution. I want a git repo to use the filesystem in my dropbox, and be able to commit to github via Java.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:01:04+00:00Added an answer on May 27, 2026 at 3:01 am

    This sounds like you’ve added the files to a bare repository. A bare repository should not be touched, except through git push and pull commands (or git commands in general). As a guide, I don’t ever look in my bare repositories.

    It should be used as a central location. Once you’ve created the git bare repo, you should clone it and then work on it from the clone, pushing and pulling from the clone.

    $ cd /dropbox/repo
    $ git init --bare
    $ cd /workdir
    $ git clone file:///dropbox/repo
    $ add files in here
    $ git add .
    $ git commit -m "initial version"
    $ git push origin master
    $ more changes here
    $ git add etc.
    

    The difference between this and github is the git clone, which then comes from a different place. To be quite honest, unless you’ve got a really good reason to have a local copy, I’d just forget about the dropbox repo and just use github.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Today, I ran into this weird problem with a user using Mac OS X.
Today I discovered that my fresh installation of Apache HTTP Server is able to
Today, I was trying to cast a hard-coded value into a short and S
Today I got into a very interesting conversation with a coworker, of which one
Today's Daily Vim says this: Assuming you're using the bash shell, the following can
today i ran into a possible size limitation of geography type Linestrings within Sql
Today I was listening to the Hanselminutes show about .NET 3.5 SP1...What's inside ,
Today I was working on a tab navigation for a webpage. I tried the
Today I had a coworker suggest I refactor my code to use a label
Today I stumbled about a Problem which seems to be a bug in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.