Mike A Mike A - 1 year ago 65
Git Question

What is the correct way to connect my package to GitHub after installing it via composer install

I created a composer package inside the vendors folder in a Laravel installation.

I then created a GitHub repository and initialized a git instance in the package to version control my changes on GitHub.

Finally, I installed my package on the same Laravel installation via the composer. (I added my package name and version to the

file and then executed
composer install

Now, on the same project, I want to be able to make more changes to the code and then add it to the repository.

I made the changes to my file. but then I did
git add .
I get the following error

fatal: Not a git repository (or any of the parent directories): .git

I think when I installed the package, it deleted the .git file which is why I got this error.

Without screwing anything up, what is the best way I can connect my existing code to GitHub so I can push the new changes?

Answer Source

1 - Delete your package folder in vendor

rm -rf vendor/yourname/yourpackagename

2 - Instal it again with sources

composer update --prefer-sources

The result of this is that vendor/yourname/yourpackagename will be a git repository in the end, and you should be able to commit and push again.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download