Laravel git ignoring images uploaded to storage - laravel

I'm running into an issue which i haven't been able to solve yet.
I was working on a laravel project and than moved this project folder to a newer version of MAMP. So far so good, everything was working fine. I just copied all the folders and files and all was good until i logged in to my laravel application on localhost and uploaded some images.
I know i can do this on my host but i like to work on localhost to add content and than push it to my prod env. Anyway, after i uploaded some images and did a git add . and commit it didnt add my uploaded images, on phpstorm they also turn out red in the storage/app/public/images folder.
On my previous mamp version everything used to work fine.
Stuff I have already tried:
I tried deleting the symlink storage folder and make a new link, didn't help.
I tried deleting the storage folder from gitignore, also didn't help.
My gitignore file looks like this:
/node_modules
/vendor
/public/hot
/public/storage
/storage/*.key
.env
.env.backup
.phpunit.result.cache
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
/config/database.php
/public/sitemap.xml
When i login on my prod env and i upload images, they turn up fine, but i prefer sometimes to work from localhost to write content and push it to env.
I have also tried to:
git check-ignore -v -- path/to/file
To check why the file (image) is being ignored but it doesnt return anything.
I got one time a message with: Fatal: pathspec ... is beyond a symbolic link.
I hope someone can push me into the right direction. Thank you.

Related

Laravel deployment - avoid overwriting storage directory when deploying from git

I have a laravel app where users can upload images. The images are uploaded to the storage/app/public/images folder which has a symlink to public/storage
The first time i set up the project on digital ocean I use the following command to deply from github:
cd /var/www/html/quickstart
git clone https://github.com/laravel/quickstart-basic
Development and testing of the app is done locally and then pushed to github. After any patches I run the above each time to redeploy the updated application but that overwrites the storage directory.
How do I push updates to my live site from github without overwriting the storage directory?
Please note i'm not an expert on git so bear with me.
* UPDATE *
Note currently i have a gitignore file in the storage\app\ directory which has:
*
!public/
!.gitignore
There is also one inside storage\app\public\ directory which has:
*
!.gitignore
you can add the directory to .gitignore file.
like this:
/storage/app/public/images/

Cmder seems to be broken after git push, how can I fix the clink.lua?

I'm working in a group using GitHub, and when I tried transferring my work to the remote repo it didn't allow me to. It says I must do git pull first, so I did. That created some conflict in my code, then I tried to do git push again and that didn't work either.
So I switched to a new branch and tried to push from there. Didn't work with a simple git push, but a similar instruction worked for me.
Since then cmder keeps showing this:
C:\laragon\bin\cmder\vendor/clink.lua:219: attempt to index local 'HEAD' (a nil value)
C:\laragon\www\pharmacie>
Which allows me only to use instructions like php artisan serve, but not Git instructions like git status...
I already tried some clink.lua code that I found on github, but didn't work.
I tried abandoning my project, so I cloned the remote repo locally.
But then it didn't clone the vendor folder or the .env file; so I added them from an other repo (so it could compile) and changed the DB name in the .env file to match my project.
Now it keeps giving an error that says the table of the project I got vendor + .env from doesn't exist. But I didn't leave that table in the .env, I changed it to my project.
Any help?
Your problem is probably due to a conflict in a file you didn't handle.
When there is a conflict, a file usually looks like this:
<<<<<<<<< HEAD
// Some code
==============
// Some other code
>>>>>>>>> branch
And you have to choose what you want to save and what you want to delete after the merge.
So I would recommend to you to check your C:\laragon\bin\cmder\vendor/clink.lua file at line 219 to see if it could contain what I just said above.
And by the way, you should add your vendor folder in your .gitignore
And for the problem with your .env file, did you run php artisan migrate ?
EDIT
And because the problem come from your vendor folder, you could resolve it by deleting your vendor folder and run composer install to reinstall your dependencies
I have been facing the same issue. I resolve the issue by updating the cmder.
As like the image above for that click on the upper right corner (Setting) on the cmder window.
1. Choose: General -> Update
2. Check the Startup checkbox for (Do automatic check on) and then
3. Click the save settings button
4. Restart the cmder.
5. It will prompt for update and allow it to update.
6. Restart cmder again and it will resolve the issue.
I repair it as follows:
clone the repository again into another folder
access the hidden .git folder and copy only the folders (hooks, info, logs ...), do not copy the files
replace the folders in the .bin folder of the newly cloned project with the old one
with this I recover the branches and the code of my project, I hope and it will be useful to someone.

Laravel - views folder getting deleted repeatedly

Using Laravel Framework 5.5.0.
The /var/app/current/storage/framework/views folder is constantly getting deleted.
Has anyone experienced this behavior or know why this would be happening?
*Also worth noting I attempted to circumvent this by setting the immutable flag on the directory but then my frontend stoped working.
Looks like the folder is getting deleted because there is no files tracked by git inside.
Try to add .gitignore to the storage/framework/views with the following content:
*
!.gitignore
Then remove all gitigore rules for views folder in root .gitignore.
You should be able to add this file to git index and commit. The problem should be fixed after next deploy.
See: How can I add an empty directory to a Git repository?

Can't see images in localhost

I'm starting to develop a site in ubuntu 14.04. I'm using apache2, so I placed my files under /var/www/html/ folder. Everything was working fine, but I had to restart my current work so I copied the entire project folder from another path, like this
$ sudo cp ~/path/to/folder /var/www/html/
And now I can't see my images, a simple imgtag. I just see this.
When I look for the file, I can see that I'm having an error 403 forbidden. I saw some suggestion to add the option Require all granted but that option is already set in my apache. I suspect that is because the new folder is a copy from a folder without root permissions, so I tried chmod but that also didn't work so I'm completly lost now.
So, how can I see my images from localhost? and most important is why this happen suddenly?

Can't see a cloned GitHub repository in OS X localhost directory

I have my Apache server running under localhost on OS X, as per this guide.
I recently tried cloning the private repository for my website from my GitHub account to my ~/Sites/ folder, but it does not show up when I navigate to localhost/~USER/ in Chrome.
At first I thought it was a problem with Git in general, but I cloned a number of other repos, both public and private, and all of those show up fine.
If I create a new folder and copy the files into it, then that is viewable from localhost, but this breaks my repo. However, if I copy the files using cp -rp ./source-directory/. /new-directory/, the .git files are copied but the folder is still unviewable from localhost.
Anyone have any ideas?
After a lot of fiddling, I discovered that the issue was due to the presence of a .htaccess file in the repo.
It appears the file in question was messing with the Apache localhost server, which was causing the folder to be inaccessible.

Resources