Goal: practise one small, reversible Git round trip before using the same pattern for approved research code. This is an optional reference exercise. It does not submit a Passport lesson or change your Passport progress.
Prerequisites: complete the Euler access lesson and the Git lessons if they are assigned to you. If Git is not in your Passport route, learn the Git workflow before this optional exercise; it is not required to pass the Euler lessons. Use your own GitHub account and personal Euler account. Keep the Passport exercise fork out of this demonstration.
Where commands run: commands marked your computer run in PowerShell on
Windows, Terminal with zsh on macOS, or Terminal with Bash on Linux. After
ssh euler, commands marked Euler run in Bash on an Euler login node in
that same terminal window. A Slurm job runs elsewhere; do not put GitHub login,
git pull, or git push in a batch script.
If opening a terminal or running a command is new to you, use the
command-line basics before step 1.
The Route#
your computer -- push --> your private GitHub demo repository
^ |
| | clone or pull
+-------- pull <-- Euler login node -- push --> GitHub
The demo contains only a fictional text file. For research work, keep small reviewed code in Git, approved data and results in their assigned storage, and record the exact commit used by a job. Ask the project owner before using a real repository or adding a GitHub credential to your Euler account. A direct push to the demo's default branch is acceptable only because you own this disposable practice repository; follow the project's branch and pull-request rules for lab code.
1. Prepare A Separate Private Demo Repository#
Where: your computer, outside the managed Passport folder. First check that
GitHub CLI is signed in as your intended personal GitHub account. Before
running the creation command, check that you do not already have a folder or
repository named passport-euler-sync-demo; if you do, stop and inspect it:
gh auth status --active --hostname github.com
cd "$HOME"
gh repo create passport-euler-sync-demo --private --add-readme --clone
cd "$HOME/passport-euler-sync-demo"
git status --short
The GitHub CLI creates a private repository in your own account and clones
it in your home folder. Do not run this from a research repository or the
Passport's managed folder. git status --short should print nothing. If
gh auth status names the wrong account or creation fails,
use the Git workflow recovery
before continuing.
Create sync-demo.txt containing exactly one line, Written on my computer.
Use any plain-text editor. If you prefer a terminal command, choose only
the block for your computer:
Windows PowerShell on your computer:
'Written on my computer' | Set-Content -LiteralPath sync-demo.txt -Encoding utf8
macOS zsh or Linux Bash on your computer:
printf 'Written on my computer\n' > sync-demo.txt
Then, on your computer:
git add sync-demo.txt
git commit -m "docs: add computer sync marker"
git push
git rev-parse HEAD
git status --short
Expected: GitHub shows sync-demo.txt with the computer line. Keep the
commit ID printed by git rev-parse HEAD for comparison. The final status is
empty. If Git asks for a commit name or email, follow the
Git identity procedure in this
demo repository; do not guess or change every repository's settings.
2. Check GitHub Access From Euler#
Where: connect from your computer with ssh euler, then run the following
on the Euler login node. This GitHub authentication is separate from the SSH
key that lets your computer enter Euler.
First try the access you may already have:
ssh -T git@github.com
GitHub's successful response begins Hi YOUR_USERNAME! and says it does not
provide shell access. Compare that username with the account that owns the
demo repository. GitHub documents that this successful test can return exit
code 1. On first contact, compare the presented host-key fingerprint with
GitHub's published fingerprints
before accepting it. If the correct account responds, keep this working setup
and go to step 3. If the wrong account responds, stop and ask for help.
If no GitHub key works, create a new key on Euler. Never copy the private key from your computer to Euler, reuse the computer-to-Euler key, or enable SSH agent forwarding. Inspect the dedicated filename first:
if [ -e "$HOME/.ssh/id_ed25519_github_euler" ] || [ -e "$HOME/.ssh/id_ed25519_github_euler.pub" ]; then
printf 'STOP: inspect the existing Euler GitHub key files before continuing\n'
else
umask 077
mkdir -p "$HOME/.ssh"
ssh-keygen -t ed25519 -a 64 -f "$HOME/.ssh/id_ed25519_github_euler"
fi
Choose a nonempty passphrase when asked. If either file already exists, do not overwrite it: ask for help checking whether the pair is usable. Display only the public half:
cat "$HOME/.ssh/id_ed25519_github_euler.pub"
In your computer's browser, open GitHub Settings > SSH and GPG keys > New
SSH key. Name it Euler GitHub access and paste the public line there. Never
paste the private file's contents into GitHub, the Passport, chat, or a
repository. GitHub may request confirmation in the browser.
Back on the Euler login node, test the dedicated key:
ssh -i "$HOME/.ssh/id_ed25519_github_euler" -o IdentitiesOnly=yes -T git@github.com
Expected: Hi YOUR_USERNAME!, naming your intended account. The key's
passphrase may be requested. If GitHub says Permission denied (publickey),
check that its registered public key matches this file and that you selected
the intended account. Do not paste keys or tokens into a help issue. The
GitHub SSH connection guide
explains the expected message and exit code.
3. Bring The PC Commit To Euler#
Where: Euler login node, in your personal $HOME. Choose one of the
two clone blocks below, depending on which SSH test succeeded. Each block
validates the GitHub username you type and runs in a subshell, so an invalid
value stops the clone without closing your Euler connection.
If an existing correct GitHub SSH setup passed in step 2:
(
printf 'Your GitHub username: '; read -r github_user
case "$github_user" in ''|*[^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-]*) printf 'STOP: invalid GitHub username\n' >&2; exit 1;; esac
cd "$HOME" || exit 1
git clone "git@github.com:$github_user/passport-euler-sync-demo.git"
)
If you created the dedicated Euler key, use it for the clone and save its selection only in this demo repository:
(
printf 'Your GitHub username: '; read -r github_user
case "$github_user" in ''|*[^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-]*) printf 'STOP: invalid GitHub username\n' >&2; exit 1;; esac
cd "$HOME" || exit 1
GIT_SSH_COMMAND="ssh -i $HOME/.ssh/id_ed25519_github_euler -o IdentitiesOnly=yes" git clone "git@github.com:$github_user/passport-euler-sync-demo.git" || exit 1
cd "$HOME/passport-euler-sync-demo" || exit 1
git config --local core.sshCommand "ssh -i $HOME/.ssh/id_ed25519_github_euler -o IdentitiesOnly=yes"
)
Run the comparison in the cloned demo repository:
cd "$HOME/passport-euler-sync-demo" || exit 1
git status --short
cat sync-demo.txt
git rev-parse HEAD
Expected: clean status, the computer line, and the same full commit ID you
recorded on your computer. If the folder already exists, git clone refuses
to overwrite it. Inspect the existing folder and ask for help instead of
removing it. If the commit IDs differ, stop before editing or submitting a job.
Before the next commit, inspect git config --show-origin --get user.name and
git config --show-origin --get user.email. If either value is missing or
wrong, follow the repository-local Git identity procedure
here on Euler.
4. Send One Euler Change Back, Then Verify On The Computer#
Where: Euler login node, inside the demo repository:
git status --short
printf 'Added on Euler login node\n' >> sync-demo.txt
git add sync-demo.txt
git commit -m "docs: add Euler sync marker"
git push
git rev-parse HEAD
git status --short
Expected: the push succeeds and status is empty. If Git needs an author
name or email, set an approved GitHub-associated identity for this repository
only using git config --local user.name and git config --local user.email,
then retry the commit. A commit identifies its author; the SSH key authorizes
the push. If git push is rejected, stop; do not force-push.
Where: back on your computer, in its demo clone:
cd "$HOME/passport-euler-sync-demo"
git status --short
git pull --ff-only
cat sync-demo.txt
git rev-parse HEAD
git status --short
In PowerShell, use Get-Content sync-demo.txt instead of cat if cat is
unavailable. Expected: both lines appear in order, the full commit ID
matches the one printed on Euler, and status remains empty. --ff-only refuses
to combine divergent changes silently. If it refuses, stop and use the
Git workflow guide or ask for
help. Do not reset, delete, or force-push to make the demo pass.
Applying This To A Real Euler Job#
Work in a personal code clone under $HOME, use the project-approved branch
and review process, and update the clone on an Euler login node. Before
sbatch, inspect git status --short and record git rev-parse HEAD with
your run configuration. A pending job may read files after you change them, so
use a run-specific immutable checkout or snapshot when a queued or concurrent
run must keep one exact code version. Keep project data, logs, and results in
their approved locations described by Euler storage. Do not
assume pushing from Euler is appropriate for a protected lab branch.
If blocked: stop at the first failed command and use the Passport's public help request with only the step number and a sanitized error. Never post a private repository URL, token, private key, username, or research file.