sajjad566's avatar

Storage Link disconnects on Push

Hi, I am developing a sports website where we have multiple coaches and players. I am working on images upload using livewire which is working perfectly. The system is connected to github. So, whenever I push any code. The storage link disconnects and I have to run php artisan storage:link after every push otherwise it does not connect to images on upload.

Any idea why this happens? or any way to fix this. Thanks

0 likes
7 replies
Sinnbeck's avatar

I assume that you mean it disconnect them on production and not github? How are you deploying?

sajjad566's avatar

@Sinnbeck yes on production. I am using github desktop app. Pushing through it to Github and pulling from Github using cloudways server.

Sinnbeck's avatar

@sajjad566 so the problem seems to be with how you deploy the code to cloud ways. You haven't shared how that's done

SagorIslam's avatar

Hi, Currently, I'm working with git projects to Cpanel. I have several problems. I solved all of them and I got this problem too.

#Go to your local project root dir, find the .gitignore file, and edit it. One of my project .gitignore file. u can modify this file. and make sure delete .gitignore files from particular folders.

/node_modules
/public/build
/public/hot
/vendor
.env.backup
.phpunit.result.cache
Homestead.json
Homestead.yaml
auth.json
npm-debug.log
yarn-error.log
/.idea
/.vscode

Best of luck

sajjad566's avatar

@SagorIslam I removed the .gitignore file from main directory and completely moved project but still same issue. there are alot of gitignore files inside other folders. Do you know a specific one I should remove?

SagorIslam's avatar

@sajjad566 hi, first remove #/public/storage from .gitignore file(if it still here). check public->storage[delete-> .gitignore file]. after that push ur codes again and check the result. make sure run these links:

php artisan config:clear
php artisan view:clear
php artisan route:clear
php artisan config:clear
php artisan optimize:clear

NOTE: I'm working on a shared Cpanel. but I researched a lot about how to push the git full project and still, I'm learning. u can search google too.

Another way: put these codes in ur web.php file -

Route::get('/linkstorage', function () {
    Artisan::call('storage:link');
});

Please or to participate in this conversation.