Using PreTeXt-CLI to publish HTML

93 views
Skip to first unread message

Shannon Ezzat

unread,
May 11, 2022, 11:02:46 AM5/11/22
to PreTeXt support
Hi All,

I'm a new PreTeXt user, and am trying to use the CLI to publish my html to my Git. However, when I try to publish I'm getting the error "Target's project must be under Git version control"

I'm guessing there's something wrong with the way I have my repository set up, but I'm not sure what the problem is (I'm brand new to both PreTeXt and Git, so it might be something very easy). Any ideas what the issue could be, or do you know of a good resource for learning how to set up Git to build/publish PreTeXt? 

Rob Beezer

unread,
May 12, 2022, 2:27:28 PM5/12/22
to pretext...@googlegroups.com
Dear Shannon,

I've not done this myself, so nothing concrete to add. I know that at least half of the CLI devs is also busy with a big PreTeXt-related grant proposal due today.

But, if your GitHub repo is public, perhaps it would help to share that here?

Rob

Sean Fitzpatrick

unread,
May 12, 2022, 3:43:47 PM5/12/22
to PreTeXt support
Here is a video by Steven Clontz that walks through the process: https://youtu.be/iFb5Mh_leq0
Steven did everything on CoCalc but most of it should adapt to using Windows. (I happen to know Shannon is on Windows ;-)  )

I will assume the following prerequisites:

- Git for Windows is installed, including Git Bash
- You've installed Python, and used Python to pip install pretextbook
- VSCode is installed, and set to use Git Bash as its terminal (I think I had the option to do this when I installed it)
[The default is PowerShell. But in PowerShell, you have to do 'python -m pretextbook foo' while in Git Bash you can just do 'pretextbook foo'.]
- You have a GitHub account, and you've created an SSH key in Windows using Git Bash, and added it to your GitHub account

Now you're ready to start your book.

If I remember right, in Steven's walkthrough, he does:

- 'pretext new book' to start a new book project
- change directory into the folder that is created
- 'git init' to initialize this as a git repository
- then publish to GitHub (I forget the steps but I think there's some configuration involved)

An alternative way to get started:

- In GitHub, click the "New" button to add a new repository.
- In the setup page, add a readme and gitignore to initialize the repository. (There is no good template to choose for the gitignore file)
- clone the new repository.
- Back on Windows, do 'pretext new book'. This probably doesn't put the files where you want them, so copy everything into the folder created when you clone your git repository.
- Now use Git Bash or GitHub Desktop to make an initial commit, to add the files to GitHub

With that out of the way, go into the folder you've created for your project.
- run 'pretext build html' to build your html (or 'pretext build html -d' if you need to build diagrams)
- now, as long as everything is working correctly, you can run 'pretext deploy', and your book should get published to GitHub, in a 'docs' folder.

Now in GitHub, go to the Settings tab, choose Pages, and then choose your branch, and the docs folder, to create the book.

Sean Fitzpatrick

unread,
May 13, 2022, 1:12:41 PM5/13/22
to PreTeXt support
Here's a video walkthrough: https://youtu.be/tAtdzyVBcZA
Reply all
Reply to author
Forward
0 new messages