Setup scp in a Github Action #

Last updated March 17, 2026
git
  • create ssh keypair on the server as a specific user used just for uploading
  • copy the private key to a github secret
  • append the public key to the .ssh/authorized_keys file
  • make a github action that uploads the artifacts using this scp action

The action looks like this:


name: Publish Brain

on:
  push:
    branches: [main]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v3
      - run: npm ci
      - run: npm run build-brain
      - name: copy file with ssh password
        uses: appleboy/scp-action@v0.1.7
        with:
          host: myserver.com
          username: deployuser
          port: 22
          key: ${{secrets.DEPLOYUSER_PRIVATE_KEY}}
          source: "*.html"
          target: remote_path

Signatures #

Last updated March 17, 2026
git

So you make a commit and pushed it to GitHub, then realized you forgot to sign it. fix it with git rebase HEAD~N --signoff. where N is the number of recent commits you need to sign.

git pull
git rebase HEAD~1 --signoff
git push --force

Stacked PRs #

Last updated March 17, 2026
git

This means a branch of a branch, which is useful when you want to work on a second feature depending on the first PR, while the first PR is still being reviewed.

# create a branch
git branch b1
git checkout b1
# do your code changes and commit them
# create a second branch
git branch b2
git checkout b2
# do your code changes and commit them
# print the branch status
git branch -vv
# make sure the first branch is pushed to github (or whatever your origin)
git push -u origin b1
# make sure the second branch is pushed to github (or whatever your origin)
git push -u origin b2
# this will print a link to create a PR on github.

Fancy Repo Syncing #

Last updated March 17, 2026
git

If you have two local copies of a repo, you can add one as a remote for the other, to push branches between them.

First, add the second dir as a remote for the first, giving it a name (josh_fork in this case).

git remote add josh_fork ../hiero-consensus-node-personal

Then push to that local remote with -u.

git push -u josh_fork

Git Basics #

Last updated March 17, 2026
git

checkout a branch

git checkout branchname

force git to forget about a file

git rm --cached .gitbook/assets/Jenkins.png

to restore a file to what it was before current working changes

git restore file

to abort a rebase operation

git rebase --abort

show the remote url

git remote show origin

show the status of your branches

git branch -vv