Gitignore CodeIgniter - codeigniter

Before I put my very first (CodeIgniter) application on Github, I have a question about the CodeIgniter .gitignore file (see below). I do not have a development directory in my config directory. Can I just .gitignore */config/* instead? What is the importance of the development directory in the config directory?
*/config/development
*/logs/log-*.php
*/logs/!index.html
*/cache/*
*/cache/!index.html

Many people set up development and production folders in their config folders. Codeigniter will load the correct file from the correct folder depending on the environment you set in the main index.php
If you're creating a public repository on github copy the files with passwords and keys (your config.php and database.php are the only two that come standard with the framework I believe) to a new folder called development inside config, then remove the passwords and paths and things from the ones in the root folder. Leave the gitignore as is.
This way when you push to git you aren't pushing your personal private information to the project.

Related

Productive files from Laravel 8?

A quick question:
which files or directories from Laravel 8 needs to be transferred to a production system or Muße the entire files and directories?
Well, yes, you have to move all the files including the vendor directory which has all the php dependencies (unless you can run composer install in production, in that case there's no need to upload the vendor directory). If you have local logs and cache in the storage directory, you can omit those.
You will also need to create a new .env file for production.
And, if your are using JavaScript with Laravel Mix, you don't need to upload the node_modules folder, only the compiled js or css files.

Correct method of deploying Laravel 8 Application through cPanel

I designed a Laravel 8 app and successfully deployed it via cPanel. What I did was create a git repo in my cPanel. Connected that repo to my local app folder. Pushed the repo from my laptop and deployed it via git's post-receive hook to the public_html folder.
Now what I request you seniors to tell me, is what is the best practice of deploying the Laravel project.
a) should I deploy directly to my public_html folder via git repo (as I have done) or
b) should I deploy it to another folder and create a symlink pointing to public_html folder.
After deploying, i found that all my folders in storage folder where images are stored, have been deleted/removed. Should I again create those folders and try to create a symlink as I do in local project or there is some other procedure for doing that?
Regards
The public directory in your project needs to be the public facing directory. From what you have described, you need to point public_html to your public directory. So you probably will have to deploy to another directory.
You will need to recreate your storage directories and files, as it sounds like they are being ignored. Check your .gitignore file to make sure the proper files and directories are being tracked.

Laravel Email Templates on Production Server

On my local development server I have changed the default email templates, however, once I have pushed to the production server I notice that those changes don't push because the vendor folder is included in the gitignore file.
What is the best way to get my local changes moved to the production server? I have already published the files on the production server, but how would I access those files to make the changes?
Thank you!
You can safely commit contents of the vendor directory inside resources/views. If no .gitignore is present in the resources/views directory, add one with the content !/vendor. This will unignore the vendor directory within this path.
Side note:
I guess you have vendor/ written in the .gitignore of your projects root directory. This is a special syntax that will use inheritance across your project, meaning the vendor directory is not only ignored in the root directory, but also all sub directories. In theory, if you change the entry to /vendor, the other vendor directory within resources/views should be unignored automatically without an extra .gitignore. But be careful to not unignore other unwanted vendor directories...

Using git and xcode, some folders are not commited

I'm new to git and just started using bitbucket in xcode.
Is it normal that some folders are not commited?
Folders like:
resources, libs, framework, supporting files, products - are missing when I view the folders in bitbucket site.
Thanks...
Please check your .gitignore file, maybe it has that folders listed there

Extra directories and files added to git repository

I had always used Git locally on Mac OSX and decided to try out Github and Bitbucket. I had some issues getting it working and tried a few fixes that others suggested who had similar problems. I was able to push to Github and Bitbucket, but I also managed to somehow add extra directories and files to my repository in the process.
I'm using Xampp to develop locally, and I have a folder in there that I created my repository with, so the file structure is something like this
Applications
XAMPP
xamppfiles
htdocs
myproject -this is was originally the repository that I had been using
randomdirectory1
randomdirectory2
randomdirectory3
randomfile1
randomfile2
One thing to note. Not every single directory and file in htdocs was added to my repository. There were only 3 added, and about 7 other folders.
Prior to trying out github my repository just consisted of myproject located in /Applications/XAMPP/xamppfiles/htdocs/myproject. Now, there are a bunch of other directories and files added to it. I know this, because in conjunction with the command line I also used GitX for a visual reference. Now, all of these extra files and directories are showing up.
Maybe I don't fully understand how git repositories works. Prior to this, I had only used add, commit and checkout commands. All I know is that my repository appears to be different in GitX and matches on Bitbucket/Github.
What folder did you initialize the Git repo from? It sounds like you meant to init from the myproject folder, but instead you did it from the Applications folder.
Does GitHub show all those extra directories?
Where is the hidden .git folder?
Is this a private repo just for you, or just for you and a few known others? Are you willing to rewrite history?

Resources