How do I push files specified in .gitignore?

If I have a “vendors” directory in my .gitignore, is there a way I can set up a remote that will receive that directory anyway when I do a push?

  • Composer says Git not found
  • The package is not available in a stable-enough version according to your minimum-stability setting
  • Composer/WordPress : wp-content directory should or should not be committed
  • Using Composer and Private Repository on GitHub using VCS on Build Server
  • Cannot run phploc installed through composer
  • autoload bitbucket repository + composer.json
  • Why does git break if '/' is the root of the repository?
  • error: The following untracked working tree files would be overwritten by merge: .gitignore
  • Git asks to commit or stash, but there's nothing to commit
  • Pushing to TFS git using public/private key
  • Are their names the same: a local-tracking branch, the corresponding remote-tracking branch, and the corresponding remote branch being tracked?
  • GIT how do I know who or which users cloned the repo?
  • 2 Solutions collect form web for “How do I push files specified in .gitignore?”

    I think the functionality you’re looking for can be achieved by having a branch used to deploy to your Cloud Provider.

    Setup a dev branch which includes your .gitignore file, check your incremental work into that branch.

    Merge your dev branch into your deploy branch which doesn’t contain a .gitignore file but contains the vendors directory.

    once you’ve completed your merge, push to the deployment remote from your deploy branch.

    Your .gitignore file has nothing to do with pushing. It is used by things like git status and git add to figure out what files should be (or could be) part of a future commit. You can add things that are ignored using the git add command; it will throw an error unless you use the -f option:

    The following paths are ignored by one of your .gitignore files:
    somefilename
    Use -f if you really want to add them.
    fatal: no files added
    

    Once you’ve added the file to the repository, it will be pushed along with any other changes.

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