Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git add command fails saying "filename too long"

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.

like image 435
user6123723 Avatar asked Dec 20 '13 18:12

user6123723


1 Answers

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:)

like image 62
nehem Avatar answered Nov 02 '22 22:11

nehem