How To Link To A GitHub PDF Without Downloading It?

Published: 19.02.2023

Do you need to provide access to a PDF file stored on GitHub without forcing your visitors to download it? I needed it to link to my CV on my About page, and it was not as easy as I had hoped! So, let’s learn how to do it, and let’s get started!

Different ways to upload a PDF file to GitHub

Linking to a PDF file on GitHub without downloading it can be done by either uploading the file via “Add file” > “Upload files” in the repository or by pushing a local PDF file to the repository. Once the file is uploaded or pushed to the repository, you can access the file directly from the GitHub repository.

The problem when linking to a PDF on GitHub

The expected way would be to copy the URL of the PDF file and create a link to it: (For demonstration purposes, I will use my CV.) When you click on this link, a new tab is opened, and the PDF file is downloaded automatically without providing a preview. This is a really unpleasant user experience, in my opinion. Thus I looked for a way to let my visitors see a PDF file without downloading it first.

So, to actually create a link that does not automatically download the file, I found two different methods. Both work, but I prefer method 2.

Method 1 (Google Viewer):

In the first method, we will use Google Viewer to show our PDF. This is a really simple approach, but sadly we rely on Google Viewer, and if the visitor likes the PDF, it is not so easy to save it locally. To create the link, we append the URL of the PDF file to the following URL: For the example of my CV, this would look as follows:

Need help or want to share feedback? Join my discord community!

Method 2 (GitHub Pages):

In the second method, we will host the PDF file using GitHub Pages and then link to that version of the PDF. Therefore we follow these steps:


If this guide is helpful to you and you like what I do, please support me with a coffee!

  1. Open the GitHub Repository
  2. Go to: “Settings” > “Pages”
  3. Select the main/master branch and click on “Save”
    link to a github pdf without downloading: pages configuration
  4. Now, wait till the setup is done. You can check the status under https://<username><reponame>. After the 404 error is gone, it is online.
  5. Now you can create a link to the PDF with the following URL: https://<username><reponame>/<path/to/file.pdf> As an example with my cv:

With that, you created a link to a GitHub PDF without forcing your visitors to download it! Tell me which method you prefer and if you have any other questions!


In conclusion, linking to a PDF on GitHub without downloading it is a simple task that can be achieved through either Google Viewer or GitHub Pages. Choose the method that works best for you and your visitors.

Don’t miss out on any updates or future guides by subscribing to my monthly newsletter.

Discussion (4)

Add Comment

Your email address will not be published. Required fields are marked *