Using Git with Dandelion for Deployment

Tamrakar Shreyaa
2 min readDec 27, 2022

It is free, simple, and integrates with any process that uses Git for version control. In fact, it uses Git to determine what has been changed since your last deployment and uploads or deletes files for you based on your change sets in Git.

You install the Dandelion Ruby gem, configure a file called dandelion.yml, commit your files to Git, and run the dandelion deploy command from your site root in your terminal to deploy the changes.

Once RubyandRubyGems are installed , Open up Terminal and run the following:

$ sudo gem install dandelion

for Mac user

$ gem install dandelion

You may need to install pkg-config and cmake before installing Dandelion. They're likely available in your OS package manager. For example:

$ brew install pkg-config cmake

OR

$ apt-get install pkg-config cmake

next

$ sudo gem install net-sftp

Create a dandelion.yml file in the root of your website directory

adapter: sftp
host: user host name or IP
username: username
password: password
path: path/to/site

exclude:
- .gitignore
- dandelion.yml

To make sure dandelion is correctly installed, we can run dandelion command in terminal .

$ dandelion

Invalid command:
Usage: dandelion [options] []
-v, --version Display the current version
-h, --help Display this screen
--repo=[REPO] Use the given repository
--config=[CONFIG] Use the given configuration file

Available commands:
status deploy
$ dandelion status
$ dandelion -h
$ dandelion version
$ dandelion --config

We have Dandelion installed we just need to configure our production server so we can deploy our local get repo and it’s committed changes to production.

$ dandelion status
Connecting to sftp://myusernamehere@host.com/test
Remote revision: ---
Local HEAD revision: 1e7116749a78990e599561b0d674311a512f839b

Create a new file on the remote server called .revision and put in that string of text from the output of ‘dandelion status’ we ran earlier.

1e7116749a78990e599561b0d674311a512f839b

then upload it to the webroot of the remote web server.Now run dandelion status and you should see Remote revision and Local HEAD the same SHA hash. Now you can run dandelion deploy and it will deploy all of your changed files in that commit

$ dandelion status
Connecting to sftp://myusernamehere@host.com/test
Remote revision: 1e7116749a78990e599561b0d674311a512f839b
Local HEAD revision: 1e7116749a78990e599561b0d674311a512f839b

Deploy to Production and Staging

$ dandelion --config=staging.yml deploy

$ dandelion --config=production.yml deploy

--

--

Tamrakar Shreyaa

Laravel | PHP | API | AJAX | jQuery | Laravel vue | Livewire | LAMP stack | CI CD