Search code examples
gitlaravelstoragegitignore

How to upload some files inside of /storage subdirectory?


In my laravel 5.7 application I use storage with command

php artisan storage:link

as I upload my files to /storage subdirectory they are not uploaded to git, as root .gitignore of my project has has default options:

/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
/.idea    $ git add .
$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        modified:   .gitignore
        new file:   public/storage
/.vscode
/.vagrant
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
.env

I tried to modify this file like :

/node_modules
/public/hot
/public/storage/clockwork
/public/storage/debugbar
/public/storage/framework
/public/storage/logs

/storage/clockwork
/storage/debugbar
/storage/framework
/storage/logs

/vendor
/.idea
/.vscode
/.vagrant
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
.env

But looks like it did not help , as no files were added to git upload(I have a lot of files in

  $ git add .
  $ git status
    On branch master
    Your branch is up to date with 'origin/master'.

    Changes to be committed:
      (use "git reset HEAD <file>..." to unstage)

            modified:   .gitignore
            new file:   public/storage/storage/):

    $ git add .
    $ git status
    On branch master
    Your branch is up to date with 'origin/master'.

    Changes to be committed:
      (use "git reset HEAD <file>..." to unstage)

            modified:   .gitignore
            new file:   public/storage

Which is the right way ?

Thanks!


Solution

  • Inside storage/app/public will be a .gitignore file that will need to be removed or edited to your liking.

    There is also one in storage/app if you want to commit everything in storage/app (not really recommended)