push branch tarball to github with git

I have a git branch with let us say 2 directories, with some code files in it:

  • htmlcode
  • jscode

and I’ve made a tarball of this 2 directories in the same branch with Git. But to create a tarball with Git you need to do “git add htmlcode jscode”

The problem I now have is that it pushes all the files in my branch (i.e. htmlcode, jscode and the tarball) to Github. I know why this happens, but don’t know how to make a work arround to push only the tarball to Github.

Can anybody help me?

  • How do I get the effect of GNU tar's --strip-components with git-archive?
  • zip or tar the resulting files with command “git status” over modified files. Linux
  • Create and upload tar.gz to S3 bucket
  • How to extract tar (ed) Android repo?
  • How to have git treat tar archives transparently as directories?
  • rsync out of git repository or tar archive
  • How do I pipe a git clone to archive (tar or gzip)
  • git archive preserve time
  • One Solution collect form web for “push branch tarball to github with git”

    No part of this makes sense. Why are you using Git to generate the tarball, if you don’t want to include the original files in Git?

    Just use the tar/gzip commands themselves:

    tar czf my-code.tar.gz htmlcode jscode

    And then (if you really do want to do this) add the resulting file to Git:

    git add my-code.tar.gz
    git commit -m "Version-controlling a tarball for some unknown reason"
    git push

    That said, there’s no reason to just be version-controlling the tarball. You really, really want to include the original source files in Git, and exclude the tarball. By only including the tarball, you’re actually just hindering Git’s built-in compression and rendering your repo more or less useless.

    Git Baby is a git and github fan, let's start git clone.