Don't build a command this way -- if the filename has spaces in it it will break.

    command = ['git', 'add', file]

would be better.