Copy local files to a Samba share on Travis
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

I am trying to set up continuous deployment for my static Jekyll site. The code is hosted on GitHub and I have set up Travis to build the site on every commit. The last step, the one I need help with, is to use Travis to deploy the website. The challenge is that I need to deploy my site to a Samba share. I have the URL for the share, which looks like this:


I also have a username and password.

The static site is in a local (to Travis) directory called _site.


What do I need to put in my .travis.yml to copy the _site folder to the Samba network share?

awarded to slr

Crowdsource coding tasks.

2 Solutions

Winning solution

try cURL (it supports SMB/CIFS protocol since version 7.40):

  - find "_site" -type f -exec curl -T {} -u "domain\username:passwd" "smb://$/" \;

set your actual credentials to "domain\username:passwd"

Three comments:
  1. When I run this, I get the following error: curl: (3) URL using bad/illegal format or missing URL I can reproduce this error locally.
  2. What does domain refer to in the above solution? or the string domain or something else?
  3. A $5 tip is available for updating the solution to use a username and passwd that are stored in environment variables.
suchow over 3 years ago
  1. it seems the trailing slash is needed in "smb://$". the solution was edited.
  2. that's the user workgroup name and it may be omitted if it isn't specified on the server.
  3. just replace username and passwd in "domain\username:passwd" with your $USER and $PWD variables.
you may find the solution still does not work and falls with curl: (67) Login denied. that's because of cURL broken NTLM v2 Authentication or something like that. try smbclient solution in this case.
slr over 3 years ago

  - smbclient //$ -U username password -c 'prompt OFF; recurse ON; mput _site'

of course you may replace username and password with your predefined $USER and $PWD variables

View Timeline