From: Dirk Süsserott Date: Mon, 03 Mar 2008 19:17:00 GMT Subject: Re: How to "git add ." when some files are not accessible (permission denied)? Message-ID: <47CC4EAC.1050905@dirk.my1.cc> In-Reply-To: <20080302011900.GC22843@coredump.intra.peff.net> Jeff King schrieb: > On Sat, Mar 01, 2008 at 02:46:28PM +0100, Dirk Süsserott wrote: > > >> The question is: is there a way to tell "git add ." to add all files but >> ignore those that cannot be added due to lack of authorization? >> > > No, there isn't. Under Linux, I would come up with a list of files I was > interested in and then pipe it to "xargs git-add", which is probably > unhelpful for Windows. > > Not quite. I'm using the msysGit package from http://code.google.com/p/msysgit/downloads/list and that comes with some fundamental unix tools like a sound shell, find, xargs, and many more. Very good! This way prepared, I used "git ls-files -o | xargs git add -v" until most of my files were added. For the rest I did "xargs -l" (ell) so that the files got added one by one. The files that still refused to be added are finally ignored by "git ls-files -o >> .gitignore". Caveat: filenames containing blanks are not handled properly as they are not surrounded by quotes. "git add" thinks of them as two or more files and fails. I figure xargs has some cool switches to sourround the parameters with quotes, but I didn't find them. An option was to write a script or shell function that does it and pipe the filenames through that function or -- as filenames with blanks aren't so numerous -- to add them manually with "git gui". Eventually, I solved the problem. Thanks for and to your pointers. :-) -- Dirk