I have a LaTeX assignment, but I don’t want to install
tex live on my own laptop because it contains thousands of small files. Maybe it can slightly protect my hard driver. Then I have to find a way to compile the LaTeX files.
Firstly, I choose to use
Overleaf - an online LaTeX tool set. It works quite good at uni, but when I get home it generally overrides my texts with an old version because of my slow network speed. That means it’s unstable in poor network environment.
So, I began to think about directly using my uni’s shared server which is installed with
tex live in the last year.
scp requires password every time, that makes one-click solution not work. So, the first step is to remove the password verification. So, the method is like
git push key.
cd ~/.ssh cat id_rsa.pub
Note, if you don’t have this file or folder, please check this post.
After this, I can see the public key. Then, copy/append them into uni’s shared server, in this file:
~/.ssh/authorized_keys. (Note: the key only has one line)
Now, I can access that server without entering password any more.
The next thing is to make everything work automatically.
The process is like this:
Me: push to GitHub Uni: pull from GitHub Uni: compile Me: Pull from uni
Access to private git repo
The idea is, GitHub provides each project a deploy key settings, which allow user to set ssh keys with
pull permission only. Uni’s shared server is not trusted, so I don’t want to give all my account’s access to that server.
Execute scripts in my PC
I want to pass command into
ssh command directly. So I searched for that,
ssh [email protected] 'bash -s' < local_script.sh
With this command, I can run local commands on remote server directly.
Here are the file contents.
cd ~/Codes/ec-groupwork/reports/report1 git pull pdflatex main.tex
A newer version just skip the GitHub server.
cd ~/Codes/ec-groupwork/reports/report1 pdflatex main.tex
Note: I didn’t use bash because uni’s server is running CShell.
So far, I can run
./pull.sh to compile & pull back the
MewX comments powered by Disqus