Home > Back-end >  Do I need to store on Github storage/framework/
Do I need to store on Github storage/framework/

Time:03-10

I have a question about Laravel and Github. Do I need to ignore storage/framework path on .gitignore?

Example on my commit:

8 files changed, 754 insertions( ), 1 deletion(-)
 create mode 100644 storage/framework/sessions/zYkePpngbtn5GNPIRMEehGFvzeVppHrVXLqhOwA7
 create mode 100644 storage/framework/views/765841d09319f048f32d8882f6bbb3f08ec2c77e.php
 create mode 100644 storage/framework/views/81232a0454b4884e95fc761f2b83d91d58048257.php
 create mode 100644 storage/framework/views/897f7ec0ff9e6c3720ffb93c900c4071f8a9940e.php
 create mode 100644 storage/framework/views/b40ed3de06d25e0481dfd99f0a59c3684ae8bb72.php
 create mode 100644 storage/framework/views/c5d64eaf0170adba24fc01265d98e0fa3d78d799.php
 create mode 100644 storage/framework/views/d5dc694ee95860847f6c74f2b3e5b4a035544513.php

I'm also running on Heroku with this same Github.

Isn't it weird that these files are uploaded to the server? I'm learning I know maybe this is a stupid question

Thanks!

Update: This is my gitignore:


# Created by https://www.gitignore.io/api/laravel

### Laravel ###
vendor/
node_modules/
npm-debug.log

# Laravel 4 specific
bootstrap/compiled.php
app/storage/

# Laravel 5 & Lumen specific
public/storage
public/hot
storage/*.key
.env.*.php
.env.php
.env
Homestead.yaml
Homestead.json

# Rocketeer PHP task runner and deployment package. https://github.com/rocketeers/rocketeer
.rocketeer/
storage/*

2update: When I add storage/ to .gitignore I got the following message on the server (Heroku):

ErrorException:
file_put_contents(/app/storage/framework/sessions/B1m3t7iCFictcEFsYXMTSqm4f7pQM2BWlJIa2G3H): Failed to open stream: No such file or directory

  at /app/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:187
  at Illuminate\Foundation\Bootstrap\HandleExceptions->handleError()
     (/app/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:231)
  at Illuminate\Foundation\Bootstrap\HandleExceptions->Illuminate\Foundation\Bootstrap\{closure}()
  at file_put_contents()```

CodePudding user response:

Actually, default Laravel's gitignore should be sufficient but here is my gitignore that I developed over for my projects.

vendor/
!public/vendor
node_modules/
npm-debug.log
.php_cs.cache

# Laravel 5 & Lumen specific
public/storage
public/hot
storage/*.key
storage/clockwork
.env.*.php
.env.php
.env
.env-production
Homestead.yaml
Homestead.json
.phpunit.result.cache
coverage/**

# Rocketeer PHP task runner and deployment package. https://github.com/rocketeers/rocketeer
.rocketeer/

# Phpstorm
.idea
_ide_helper.php
_ide_helper_models.php
.phpstorm.meta.php
.DS_Store
app/Repositories/Interfaces/UserRepositoryInterface
app/Repositories/UserRepository
App\Repositories\UserRepository
App\Repositories\Interfaces\UserRepositoryInterface
# Elastic Beanstalk Files
.elasticbeanstalk/*
!.elasticbeanstalk/*.cfg.yml
!.elasticbeanstalk/*.global.yml
storage/app/*
/tmp/
.vscode/settings.json
.php-cs-fixer.cache

CodePudding user response:

The content of storage folder should not be pushed to the repo.

Add this line to your .gitignore file

storage/*
  • Related