Remove a file from git locally, but not on remote

I have a file full of tests that fail locally, because my local environment doesn’t have some software installed. The tests succeed on our continuous integration system, and I never touch the code being tested, so I would like to remove this file locally so that tests pass locally, but not remove the file from the remote server. Is this possible using git‘s ignoring mechanisms?

  • Unable to execute - Git P4 clone broken
  • Can GitHub/BitBucket be made as your local repository?
  • Get list of files committed on git branch in last month from remote
  • Is there any git hook for pull?
  • How do i revert one file to its original state in git?
  • Non-interactive fixup until specified hash
  • Tell git that a text file is actually binary
  • Berkshelf vendoring of cookbook on private Bitbucket repository
  • How to undo a merge that has been committed already and other merges have been done after that also
  • Git workflow when you cant push or pull
  • Best source control system for maintaining different versions
  • git: How do I get the latest version of my code?
  • One Solution collect form web for “Remove a file from git locally, but not on remote”

    You can try git magic here (that is generally considered harmful)

    You just delete file with rm (not git rm)

    And then mark the file being deleted as unchanged

    git update-index --assume-unchanged <filename>

    (Though I haven’t check that following commits will not break your code)

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