11

I initialized a git repository to add a local instance of Oracle Weblogic server (Yes!) to version it using git.

The oracle files are in c:\Oracle. So I need to add the same to git

I issued the following commands

git init (in c:\ which has the Oracle directory)

added a .gitignore dir in c:\ and ignored all the directories in c:\ except for Oracle

Then ran a 'git status' to see the status. As expected, it showed the following

C:\>git status
# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       .gitignore
#       Oracle/
nothing added to commit but untracked files present (use "git add" to track)

Now, I did a git add * The above command as expected threw some verbose output showing the files that are being added and ended with the following (tail of the command output is displayed below)

....
base_domain/servers/AdminServer/tmp/.appmergegen_1387484701373_liferay-portal-6.
1.30-ee-ga3-20130812170130063.war/html/VAADIN/themes/runo/tree/tree.css.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in Oracle/Middleware/user_projects/domains/
base_domain/servers/AdminServer/tmp/.appmergegen_1387484701373_liferay-portal-6.
1.30-ee-ga3-20130812170130063.war/html/VAADIN/themes/runo/window/window.css.
The file will have its original line endings in your working directory.
fatal: unable to stat 'Oracle/Middleware/user_projects/domains/base_domain/serve
rs/AdminServer/tmp/.appmergegen_1387484701373_liferay-portal-6.1.30-ee-ga3-20130
812170130063.war/html/VAADIN/widgetsets/com.vaadin.portal.gwt.PortalDefaultWidge
tSet/043D1FB3F694D0D6D3ACFB33DB80E43D.cache.html': Filename too long

I then issued a git status to see if the files are added

C:\>git status
# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       .gitignore
#       Oracle/
nothing added to commit but untracked files present (use "git add" to track)

So it appears like nothing has been added. Is the folder too big for git?

I've tried Bazaar and its GUI controls freeze whenever I work with the repository. Now I'm trying Mercurial to see if it can handle it.

user6123723
  • 10,546
  • 18
  • 67
  • 109
  • Is there a reason you're creating the repository in ``C:\`` and ignoring a bunch of stuff instead of just creating the repository directly in ``C:\Oracle\``? – ChrisGPT was on strike Dec 20 '13 at 18:50
  • Indeed. Also, I doubt you really want to track the tmp directory with Git. – Magnus Bäck Dec 20 '13 at 18:52
  • @Chris Doing it in c:\ only for convenience. It must makes it easier to zip the whole c:\Oracle directory and ship it out as needed without including the .git folder if I init the repository in c:\ as opposed to initializing it in c:\Oracle\.git – user6123723 Dec 20 '13 at 18:53
  • 1
    @user1324816 If you create the repository in ``C:\Oracle\`` you should be able to create an appropriate zip with `git archive --prefix Oracle -o OracleWeblogicServer.zip`. Doesn't fix your problem, though. Do you have source for the product, or are you trying to version a compiled version of the application server? – ChrisGPT was on strike Dec 20 '13 at 18:56
  • @Chris Thanks for the git archive command. Bookmarked it. The Weblogic server is the standard Oracle Weblogic distribution after extracting it to c:\ (or install it). I've deployed a few applications onto it (Liferay Java Portal), cleaned the logs and set it for git'ing it. The intention for versioning is to keep track of changes to the configuration files and be able to revert it if I'm lost when making the changes. – user6123723 Dec 20 '13 at 18:59
  • @user1324816 Up to you, of course, but I'd probably lean towards versioning only the configuration directories if that's what you want to track. Git is not ideal for versioning large binary files, and without knowing much about Weblogic Server, but knowing a bit about Java and the JAR files that come with it, I suspect that's most of your repository at the moment. – ChrisGPT was on strike Dec 20 '13 at 19:05
  • 1
    The problem has been fixed in msysgit 1.9. See my answer to "git pull aborted with error filename too long" http://stackoverflow.com/a/22831095/151641 – mloskot Apr 03 '14 at 07:51

4 Answers4

8

Remap to shorter drive like this subst X: C:\<__relevant_lengthy_path__>\

--

I had a similar encounter which confirmed the 260 char limitation of Max Path length for Windows

The way I handled was using SUBST (substitute) command which maps any lengthy folder to a single letter drive, for example subst X: C:\<__relevant_lengthy_path__>\

However in your case it is big unfortunate that you had git inited in just C:\ which is unusual & brave:)

nehem
  • 12,775
  • 6
  • 58
  • 84
6

I seriously doubt you really need that .../tmp/... directory. git add fails when there are any errors. If there is a problem adding any of the files you specified, nothing will be added.

I suggest to ignore the tmp directory:

echo tmp >> .gitignore
git add .

This will ignore all tmp directories in the project. If you want to ignore specific tmp directories, you can specify their full path:

echo path/to/AdminServer/tmp >> .gitignore
git add .

Since the long filenames are in that tmp directory in your sample output, by ignoring the directory the git add . should work.

janos
  • 120,954
  • 29
  • 226
  • 236
  • I ignored the tmp dir and I was able to add the folder to git. Couple of things: I originally included the tmp directory as I wanted to capture the whole state of the application server and I wasn't sure if this particular tmp directory is important in that sense. But now because I don't have a choice, I ignored it. But I'm curious to know the file name (size) limitation of GIT and Mercurial – user6123723 Dec 20 '13 at 20:49
  • 2
    I don't know. But the problem is windows-specific: I created a path twice as long as yours on my Mac and Git has no problem with it. – janos Dec 20 '13 at 20:56
  • 1
    The real gem in this answer is the fact that `git add` fails when there are any errors encountered (it would be nice if the feedback from the operation let the user know it was atomic) -- upvote! – MandM Apr 23 '15 at 14:38
6

Cygwin to the rescue! Running the same comands through Cygwin's Git worked for me.

Baz
  • 2,167
  • 1
  • 22
  • 27
4

The problem is Windows-specific: Git for Windows does not currently use that Win32 API hack of prepending \\?\ to pathnames to overcome the standard pathname length limit of 260 characters, and your pathname is 9 characters longer than the limit.

kostix
  • 51,517
  • 14
  • 93
  • 176