1

I am trying to export my existing git repo with following command. But I end up with errors. any one help me to fix this?

my command :

PS F:\Nissan-Gulp> git archive --format zip --output F:\convert master
fatal: could not create archive file 'F:\convert': Is a directory
PS F:\Nissan-Gulp>

my existing git project at Nissan-Gulp and I wish to send to 'F:\convert': folder. but not works.

user2024080
  • 1
  • 14
  • 56
  • 96

2 Answers2

1

The F:\convert path should be a file, not a directory. Create that directory and run the command with F:\convert\FILENAME, replacing FILENAME with what you'd like to name the archive.

Nick McCurdy
  • 17,658
  • 5
  • 50
  • 82
  • I tried, but still not the file created for me. my it like : ` git archive --format zip --output F:\convert\new` - new is the file name what I would like ti create in the `F` - folder. – user2024080 May 30 '17 at 08:46
  • Even though that creates the files, still the file size is `0KB` - how to fix this? – user2024080 May 30 '17 at 08:47
  • 1
    Finally I tried like ` git archive --format zip --output F:\new master ` - it works fine. thanks!! – user2024080 May 30 '17 at 08:49
0

This error message is also displayed when a file called FILENAME already exists, but is owned by a user whose files you cannot overwrite. (At least on 'nix-y systems.)

E.g:

# whoami
root
# touch release1.zip
# su schmuck
$ git archive Release1 --format zip -o release1.zip
fatal: could not create archive file 'release1.zip': Permission denied

I ran into this problem attempting to make an archive as the root user, forgetting that I was root and that the root user didn't have a proper Git config, then attempting to make an archive as a regular Joe:

# git archive Release1 -o release1.zip
fatal: unsafe repository ('/var/www/repo' is owned by someone else)
To add an exception for this directory, call:

    git config --global --add safe.directory /var/www/repo

Note that git archive makes an empty file before this "unsafe repository" check is made.

# find . -maxdepth 1 -type f -iname "*" -printf "%f\t%s\t%u\n"
foo             100 schmuck
bar             50  schmuck
baz             200 schmuck
release1.zip    0   root
.gitignore      100 schmuck

And predictably, schmuck cannot overwrite root's file:

# su schmuck
$ git archive Release1 -o release1.zip
fatal: could not create archive file 'sprint2.zip': Permission denied

Simply delete the file as root, then proceed with the archive.

$ sudo rm release1.zip
$ git archive Release1 -o release1.zip
nokko
  • 54
  • 6