I am working on an application with laravel 8, whenever I run composer update 5000+ vendor files are tracked by GitHub however /vendor is added into the .gitignore file. here is a snap of my .gitignore file:
Might be possible that you have already staged/added the vendor folder before putting in the .gitignore file. Or you have manually staged/added the folder to git through command.
In any case, one solution for you is to unstage the files by using
git reset /vendor/*
and if this doesn't solve your problem, then it might be possible that you already have committed older files into git; so, /vendor files are getting tracked by git.
Solution steps:
Delete the /vendor folder.
Make a clean commit of tracked files inside /vendor (if there are any)
Run composer install again to get back /vendor folder.
After these steps, vendor will not be tracked. (Considering /vendor/ is still present in the .gitignore file)
Related
Making pull of Laravel 5 app from external branch I got several conflict errors like
error: refusing to lose untracked file at 'vendor/composer/autoload_static.php'
CONFLICT (modify/delete): vendor/composer/autoload_real.php deleted in HEAD and modified in b871903544566b6c1fd662ac67e7987f1ecc8643. Version b871903544566b6c1fd662ac67e7987f1ecc8643 of vendor/composer/autoload_real.php left in tree.
but in .gitignore file I have vendor directory:
/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
/.idea
.env
.phpunit.result.cache
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
composer.lock
package-lock.json
1.txt
I wonder why such errors and how to fix them?
I suppose there is no sense in manually editing files inside of /vendor ?
Thanks!
that's not a normal vendor package, it the autoload generated by composer.
Run this command to generate the file anew to fix the error.
compser dump-autoload
But what you really should do is to remove the autoload from your git:
delete the tracked file & commit the change
add it to the ignore list (it should be already ignored)
push
run command dump-autoload on every installation after pull
OR follow these instructions How to stop tracking and ignore changes to a file in Git? and the do step 4
After apdate the composer in my laravel project 5k fies showing as a changes in git. how to ignore it. i already ignore vender repository in gitignore file. please help me to sort out this.
gitignore code
/public/storage
/storage/*.key
/vendor
.env
I want to make a deploy but I can't. I don't know why.
I ran the composer install command to generate the lock file...
Error log:
ERROR: No 'composer.lock' found!
A 'composer.lock' file was not found in your project, but there
is a 'composer.json' file with dependencies inside 'require'.
The lock file is required in order to guarantee reliable and
reproducible installation of dependencies across platforms and
deploys. You must follow the Composer best practice of having
your lock file under version control in order to deploy. The
lock file must not be in your '.gitignore'.
My .gitignore:
/vendor
/.idea
Homestead.json
Homestead.yaml
I committed the file.
My last 3 commits (from git log --oneline):
19cb5e3 (HEAD -> demo) env update
2ce2333 added composer.lock
285922a Demo
Can you delete your vendor folder + composer.lock and then try to run composer install.
I have tried to solve this by
Deleting all pods and re installing
Cleaning build folder
Deleting .gitignore and recreating
However there are a few files within the Pods dir that continue to show up
I'm ignoring using this in my .gitignore since my initial commit - nothing in this has ever been committed.
Pods/
Note this has only started recently with a with a new pod update
When I try to commit I get the following.
All other pods within this dir are ignored.
I have looked at these, but no luck fixing
.gitignore ignoring whitelisted folder
.gitignore not ignoring folder
Gitignore not ignoring folders
.gitignore doesn't ignore files
This looked like it may have the solution but not sure if I want to try it, so decided to post and understand the reason why this is happening
gitignore does not ignore folder
Note: Running Swift 4.2 / Xcode 10.1
You were tracking this files so they are added to index. All you have to do before ignoring this files you have to untrack them.
If you want to remove them from the index you have to type git rm -r --cached {name_folder} then use git commit -m "removed files from index" and change your .gitignore file.
When I add files to my local repository, some vendor packages are excluded even though they are not listed in the .gitignore file. Since they are not pushed to the remote repository, other developers are not able to pull the vendor packages.
The Vendors files are not to upload on github.The composer.json file of your laravel project have all the information to install all of your vendors.So try to update your composer.
To update composer use cmd or terminal command:
composer update
composer install
Be sure that the composer.json file is not ignore by .gitignore file.
Fixing the root .gitignore is not enough.
I had the same problem and found out that there are multiple .gitignore in subfolders.