I regularly use Org mode's #+INCLUDE command to include local files in my Org file. Now I'm wondering if there is a way to include remote files (i.e. files that I reference via a URL) into my main Org file so that the source code gets embedded when I export.

My current specific use case would be to add a raw code snippet from a local Gitlab instance to an Org file. I have tried the following:

#+INCLUDE: "https://url-to-gitlab/snippets/11/raw" src sh

but that gives me the following error message when exporting from Org to PDF:

org-export-expand-include-keyword: Cannot include file /home/ph0t0nix/Org_files/https:/url_to_gitlab/snippets/11/raw

1 Answer 1


Disclaimer: I'm not an org user.

The #+INCLUDE command requires valid file names in Emacs. If you want to include a remote file, you better use Tramp file names.

However, if you enable URL Handler Mode (apply (url-handler-mode 1) ), your #+INCLUDE command shall work.

  • Thanks Michael! That worked perfectly.
    – ph0t0nix
    Oct 30, 2018 at 15:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.