如何在/ storage子目录中上传一些文件?

时间:2018-09-24 14:12:43

标签: git laravel storage gitignore

在laravel 5.7应用程序中,我将存储与命令配合使用

php artisan storage:link

当我将文件上传到/ storage子目录时,它们没有上传到git,因为我项目的root .gitignore 具有默认选项:

/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

我试图像这样修改该文件:

/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

但是看起来没有帮助,因为没有文件添加到git upload(我的文件很多

  $ 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

哪种方法是正确的?

谢谢!

1 个答案:

答案 0 :(得分:1)

storage/app/public内部将是一个.gitignore文件,需要根据自己的喜好将其删除或编辑。

如果您要提交storage/app中的所有内容,则storage/app中也有一个(不推荐)