Help deploying nikola blog to Github pages?

580 views
Skip to first unread message

thientin truong

unread,
Jan 11, 2015, 7:30:03 PM1/11/15
to nikola-...@googlegroups.com

Hello,

I'm an absolute beginner in python/nikola and just programming in general. I spent a week tinkering around with nikola and I finally got a prototype page running. I'd like to deploy my site to Github pages and even though I've looked at the documentation on how to do so, I'm still at a loss on what to do. Can someone please help?

Chris Warrick

unread,
Jan 12, 2015, 3:21:27 AM1/12/15
to Nikola—Discuss
1. Create a repository for your page on GitHub. You probably want to
name it USERNAME.github.io.
2. In the directory with your Nikola site, run:

git init
git remote add origin g...@github.com:USERNAME/USERNAME.github.io.git
3. Configure Nikola. Edit conf.py and change the following settings:

GITHUB_SOURCE_BRANCH = 'master'
GITHUB_DEPLOY_BRANCH = 'gh-pages'
GITHUB_REMOTE_NAME = 'origin'

4. Run `nikola github_deploy`.

You must have git setup properly on your system. Refer to GitHub help
for more info.

--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16

thientin truong

unread,
Jan 12, 2015, 11:33:13 AM1/12/15
to nikola-...@googlegroups.com
Hi, thanks for replying. I read in another thread to publish only the output folder to Github and that seemed to work. I tried to create another test post and see if I can run 'nikola github_deploy' but I got this error, "Output folder is committed to the source branch. Cannot proceed until it is removed."

Chris Warrick

unread,
Jan 13, 2015, 12:44:12 PM1/13/15
to Nikola—Discuss
On Mon, Jan 12, 2015 at 5:33 PM, 'thientin truong' via nikola-discuss
<nikola-...@googlegroups.com> wrote:
> Hi, thanks for replying. I read in another thread to publish only the output
> folder to Github and that seemed to work.

You read old advice; you should do everything with nikola github_deploy.

> I tried to create another test
> post and see if I can run 'nikola github_deploy' but I got this error,
> "Output folder is committed to the source branch. Cannot proceed until it is
> removed."

$ git rm --cached output/

Also, my previous example was incorrect, use those settings:

GITHUB_SOURCE_BRANCH = 'src'
GITHUB_DEPLOY_BRANCH = 'master
GITHUB_REMOTE_NAME = 'origin'

then

$ nikola github_deploy

will work properly.

ThienTin Truong

unread,
Jan 14, 2015, 11:26:13 PM1/14/15
to nikola-...@googlegroups.com
Sorry, I'm really slow at this. There's been a lot of conflicting information so I started everything from scratch following your instruction.

So here are the steps I took
1) create empty nikola site with 'nikola init mysite'
2) create empty repo on github: thientintruong/nikola.git
3) in the mysite directory, I initialized a git repo with 'git init', then 'git remote add origin g...@github.com:thientintruong/nikola.git'
4) edited the conf.py to
    GITHUB_SOURCE_BRANCH = 'src'
    GITHUB_DEPLOY_BRANCH = 'master
    GITHUB_REMOTE_NAME = 'origin'
5) then 'nikola github_deploy'

But now I have the error in the shell:

error: pathspec 'master' did not match any file(s) known to git.
Traceback (most recent call last):
  File "C:\Users\TTTT\Anaconda\lib\site-packages\doit\doit_cmd.py", line 121, in run
    return command.parse_execute(args)
  File "C:\Users\TTTT\Anaconda\lib\site-packages\doit\cmd_base.py", line 79, in parse_execute
    return self.execute(params, args)
  File "C:\Users\TTTT\Anaconda\lib\site-packages\nikola\plugin_categories.py", line 102, in execute
    self._execute(options, args)
  File "C:\Users\TTTT\Anaconda\lib\site-packages\nikola\plugins\command\github_deploy.py", line 104, in _execute
self._exit_if_output_committed()
  File "C:\Users\TTTT\Anaconda\lib\site-packages\nikola\plugins\command\github_deploy.py", line 248, in _exit_if_output_committed
    subprocess.check_call(['git', 'checkout', source])
  File "C:\Users\TTTT\Anaconda\lib\subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '['git', 'checkout', 'master']' returned non-zero exit status 1

Chris Warrick

unread,
Jan 15, 2015, 9:59:51 AM1/15/15
to Nikola—Discuss
You must name your repo `thientintruong.github.io`, else it would not work.

The error was:
> error: pathspec 'master' did not match any file(s) known to git.

I suppose you need to create the `master` and `src` branches first for
things to work.
Reply all
Reply to author
Forward
0 new messages