-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add gitignore.md to advanced-topics folder
- Loading branch information
Showing
2 changed files
with
146 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
--- | ||
title: AppGini files to ignore in git repositories | ||
linkTitle: gitignore | ||
slug: help/advanced-topics/gitignore | ||
description: AppGini files to ignore in git repositories to avoid committing unnecessary/unsafe files to your repository. | ||
keywords: gitignore, git, repository, AppGini, files, folders, ignore | ||
--- | ||
|
||
# AppGini files to ignore in git repositories | ||
|
||
If you plan to [use a version control system like git to manage your AppGini application](/appgini/screencasts/how-to-use-git-with-appgini-to-manage-code-changes), | ||
you should ignore certain files and folders to avoid committing unnecessary/unsafe files | ||
to your repository. | ||
|
||
But first, let's discuss the recommended way to set up your repository for an AppGini application. | ||
The instructions below assume you are using [git](https://git-scm.com/) as your version control system. | ||
Git is the most popular version control system and is widely used by developers around the world. | ||
|
||
## Recommended repository structure for AppGini applications | ||
|
||
When you generate an AppGini application, you are asked to select the output folder for the generated files. | ||
When the application is generated inside that folder, it will create the following structure: | ||
|
||
``` | ||
your-app-folder/ | ||
admin/ | ||
hooks/ | ||
images/ | ||
resources/ | ||
templates/ | ||
index.php | ||
.. # other files | ||
``` | ||
|
||
Where `your-app-folder` is the folder you selected when generating the application. | ||
**We don't recommend creating (initializing) the git repository inside this folder.** | ||
|
||
The reason is that the repository data is stored in a `.git` folder inside the repository root folder. | ||
This folder might get uploaded to your server when you deploy your application, leading to exposing | ||
your repository data to the public. This is a security risk. | ||
|
||
Instead, we recommend setting the folder structure as follows before generating the application: | ||
|
||
``` | ||
your-app-folder/ | ||
app/ | ||
``` | ||
|
||
Then, generate the application inside the `app` folder. This way, the repository root folder will be | ||
`your-app-folder`, and the `.git` folder will be at the root level, not inside the application folder. | ||
Your folder structure after generating the application will look like this: | ||
|
||
``` | ||
your-app-folder/ | ||
app/ | ||
admin/ | ||
hooks/ | ||
images/ | ||
resources/ | ||
templates/ | ||
index.php | ||
.. # other files | ||
``` | ||
|
||
After initializing the git repository in `your-app-folder` using the command `git init`, your | ||
folder structure will look like this: | ||
|
||
``` | ||
your-app-folder/ | ||
.git/ | ||
app/ | ||
admin/ | ||
hooks/ | ||
images/ | ||
resources/ | ||
templates/ | ||
index.php | ||
.. # other files | ||
``` | ||
|
||
You can then safely upload the contents of the `app` folder to your server, without exposing your | ||
repository data. | ||
|
||
## Files and folders to ignore in your git repository | ||
|
||
Some files and folders generated by AppGini are not meant to be committed to your repository. | ||
This is either because they are generated dynamically by your AppGini application, or because they contain sensitive | ||
information like database connection details. | ||
|
||
To ignore these files and folders, you should create a `.gitignore` file in the root of your repository | ||
and add the following lines to it: | ||
|
||
``` | ||
# ignore files containing sensitive information | ||
app/config.php | ||
app/file-uploader.php | ||
app/admin/backups/*.sql | ||
# ignore files generated dynamically by AppGini application | ||
app/setup.md5 | ||
app/tmp | ||
app/admin/tmp | ||
app/plugins | ||
# ignore user-uploaded files | ||
app/images | ||
!app/images/index.html | ||
!app/images/blank.gif | ||
``` | ||
|
||
This will tell git to ignore the listed files and folders when committing changes to your repository. | ||
|
||
## TIP: Store your project file inside your repository | ||
|
||
Another advantage of setting up your repository as described above is that you can store your AppGini | ||
project file (the `.axp` file) inside your repository. This way, you can easily keep track of changes | ||
to your project file and revert to previous versions if needed. | ||
|
||
To do this, simply copy your `.axp` file to the root of your repository and commit it to your repository. | ||
The folder structure of your repository will look like this: | ||
|
||
``` | ||
your-app-folder/ | ||
.git/ | ||
app/ | ||
admin/ | ||
hooks/ | ||
images/ | ||
resources/ | ||
templates/ | ||
index.php | ||
.. # other files | ||
your-app.axp | ||
``` | ||
|
||
Where `your-app.axp` is your AppGini project file. Please note that in the above example, the project file | ||
is stored in the root of the repository, outside the `app` folder. This is recommended to avoid exposing | ||
your project file to the public. The project file contains your entire database structure and settings, | ||
so it's important to keep it secure. | ||
|
||
## Related topics | ||
|
||
* [Using git with AppGini to manage code changes](/appgini/screencasts/how-to-use-git-with-appgini-to-manage-code-changes) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters