Switching to a Git Install

As we mention (several times) throughout the documentation, installing via Git is our recommended way of installing Snipe-IT and keeping it up to date. If you installed manually (downloading a tarball or .zip file from Github), you can still switch to a Git install with just a little work. Doing so will change your upgrade workflow from downloading a new zip, copying folders and files, and running a bunch of command to running one command - much easier!

🚧

Note:

When you switch to a Git install, you're using the same database as your manual install. There is no need to perform any actions as root, or no new databases or web server configurations need to be made.

You'll do the following process only once to switch you from a manual install to a git install:

1. Make sure you have Git installed

Obvious, but kinda important. Make sure you have downloaded and installed Git. If you're not sure, you can type git --version. If it gives you a version number, you have Git installed. If it tells you the command is not found, you don't have Git installed and will need to install it.

2. Backup your old install

From the command line at your Snipe-IT project root, run:

php artisan snipeit:backup

This will back up your uploaded file, and will create backup of your database.

3. Rename your Snipe-IT project root folder

You'll want to rename it to something like snipe-it-backup. You only need this to be able to copy your uploaded files, your .env, etc into your new Git install.

In addition, if you are using a Windows server, remember the change the permissions on the new folder to match the old one.

4. Install via Git

git clone https://github.com/snipe/snipe-it your-folder

You'll see it pulling down a bunch of files into whatever directory your-folder is, and when it's all done, you'll see a new directory called snipe-it inside of your-folder. This will be your new project root, so if you need to move it to a different location to make it work with your web server configs, you should do that now.

5. Run composer install

Just like you did when you first installed Snipe-IT, you'll need to install dependencies using Composer.

If you installed Composer globally, you'll use:

composer install --no-dev --prefer-source

If you installed Composer locally (you use composer.phar when you upgrade), you'll need to download composer again. For more details about composer install, click here.

6. Copy over the necessary old files

You'll need to move your old uploads and old .env file over to your new Git installed version of Snipe-IT:

cp -R snipe-it-backup/public/uploads/* snipe-it/public/uploads
cp -R snipe-it-backup/storage/private_uploads/* snipe-it/storage/private_uploads
cp -R snipe-it-backup/storage/app/backups/* snipe-it/storage/app/backups
cp -R snipe-it-backup/.env snipe-it/
cp -R snipe-it-backup/storage/oauth-private.key snipe-it/storage/oauth-private.key
cp -R snipe-it-backup/storage/oauth-public.key snipe-it/storage/oauth-public.key

(If it asks you if you want to overwrite .gitignore or .gitkeep, say no.)

And that's it.

Now when you want to upgrade Snipe-IT, you can simply run:

php upgrade.php

from your new Git install Snipe-IT directory.