Thread (10 messages) flat view 10 messages, 5 authors, 2016-06-15

Re: How to "git add ." when some files are not accessible (permission denied)?

From: Dirk Süsserott <hidden>
Date: 2016-06-15 22:44:19

Jeff King schrieb:
On Sat, Mar 01, 2008 at 02:46:28PM +0100, Dirk Süsserott wrote:

  
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help