Loading...
 
Skip to main content

History: Convert a site installed via FTP to now use Git

Source of version: 2 (current)

Copy to clipboard
* With FTP, you upload / edit replace software files manually. If you edit a file, and later upgrade your site, you will lose your customization.
* With [https://en.wikipedia.org/wiki/Git|Git], each software file is tracked, including any edits to the files. And thus, your changes are merged into the update.

Context: you are taking over a Tiki site that was installed by FTP, and you now want to use Git for easy future upgrades. You may also have some modified files, and via FTP, it's time-consuming to manage this.

!! Example

In this example we will turn an FTP tiki 20.x instance (which is tagged as such in Git)  managed by Git.

We assume you are familiar with ((Get code)).

* __website__: ~~#06F:http://tikiconvert.docker/~~
* __document root__: ~~#F06:/var/www/virtual/tikiconvert.docker/html~~

!! First backup your things

1. Create a folder to place your backups
{CODE(colors="shell",wrap=0,ln=1)}
cd /var/www/virtual/tikiconvert.docker/
mkdir backup
{CODE}

2. Backup your database
{CODE(colors="shell",wrap=0,ln=1)}
eval $(sed -n '/^\$/s/^\$//p' html/db/local.php)
mysqldump -u$user_tiki           \
          -p$pass_tiki           \
          -h$host_tiki $dbs_tiki \
    | gzip > backup/$dbversion_tiki.sql.gz
{CODE}

3. Backup your current folder
{CODE(colors="shell",wrap=0,ln=1)}
tar -czvf backup/html.tar.gz html
{CODE}


!! Checkout the same version as your current Tiki install
{CODE(colors="shell",wrap=0,ln=1,caption="checkout Tiki 20.x to folder newinstall")}
git clone git@gitlab.com:tikiwiki/tiki.git -b 20.x newinstall
{CODE}

To reduce disk space, you can add the following parameter to the command above (before newinstall):
-+~np~--depth 1 --no-single-branch~/np~+-

If you have a specific version like for example 20.0
{CODE(colors="shell",wrap=0,ln=1,caption="checkout Tiki 20.0 tag")}
git checkout tags/20.0
{CODE}

If you're experiencing issues in git clone, you can use -+https://gitlab.com/tikiwiki/tiki.git+- instead of -+git@gitlab.com:tikiwiki/tiki.git+-.


[https://gitlab.com/tikiwiki/tiki/-/branches|List of all branches]
[https://gitlab.com/tikiwiki/tiki/-/tags|List of all tags]


!! Copy your old site over the fresh Git checkout

Now copy your old site over the new install, if there are any modified or new files, they will override the ones of your checkout (the working copy but not the reference files in .git/ folders).

{CODE(colors="shell",wrap=0,ln=1)}
cp -a html/. newinstall/
{CODE}


!! Check for differences

{CODE(colors="shell",wrap=0,ln=1)}
git status newinstall
git diff newinstall
{CODE}

If Git shows modified files, you should solve that before continuing. 
If you are experiencing problems with files permissions you can disable git from checking permissions.
{CODE(colors="shell",wrap=0,ln=1)}
git config core.fileMode false
{CODE}

!! Launch new instance

{CODE(colors="shell",wrap=0,ln=1)}
cd /var/www/virtual/tikiconvert.docker
mv html old && mv newinstall html
{CODE}


!! Test and remove old folder

Browse your website and check features you use are ok, after that remove -+old+- folder, but stick with your backup!

{CODE(colors="shell",wrap=0,ln=1)}
rm -Rf old
{CODE}

~tc~ (alias(Convert a site installed via FTP to now use SVN)) ~/tc~
Show PHP error messages