# How to fork when self-hosting?

**URL:** <https://forum.ghost.org/t/how-to-fork-when-self-hosting/33921>\
**Category:** Self-hosting\
**Created:** [November 5, 2022, 10:47pm UTC](https://forum.ghost.org/t/how-to-fork-when-self-hosting/33921 "2022-11-05T22:47:15Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![satonotdead](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/satonotdead/32/33666_2.png) [@satonotdead](https://forum.ghost.org/u/satonotdead)\
**Post date:** [November 5, 2022, 10:47pm UTC](https://forum.ghost.org/t/how-to-fork-when-self-hosting/33921/1 "2022-11-05T22:47:15Z")

</div>

Hi there, can we use something like that?

> <https://github.com/TryGhost/actions/blob/main/.github/workflows/custom.yml>

What we need to change if that file is OK?

I want to update some strings that I edited manually on my fork of Ghost (I keep the repo merged).

Thanks.

---

<div class="post-metadata">

**Author:** ![markstos](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/markstos/32/18182_2.png) [@markstos](https://forum.ghost.org/u/markstos)\
**Post date:** [November 8, 2022, 6:30pm UTC](https://forum.ghost.org/t/how-to-fork-when-self-hosting/33921/2 "2022-11-08T18:30:58Z")

</div>

That workflow file runs `npm pack` on a branch, resulting in a `.tgz` file of the project.

Because JavaScript, HTML and CSS are not compiled there’s not normally a need to run this step on a fork.

Also, `ghost install` installs `.zip` files, and this workflow generates a `.tgz` file. It’s not even clear that it generates something that be installed directly.

If you want to maintain some differences, I recommend you create a file in the “unified diff” file format and save it as a `.diff` or `.patch` file.

Then after you run the standard upgrade process, run something like `patch <my-patch.diff` to patch the code with your differences.

---

<div class="post-metadata">

**Author:** ![vikaspotluri123](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/vikaspotluri123/32/24_2.png) [@vikaspotluri123](https://forum.ghost.org/u/vikaspotluri123)\
**Post date:** [November 8, 2022, 7:09pm UTC](https://forum.ghost.org/t/how-to-fork-when-self-hosting/33921/3 "2022-11-08T19:09:59Z")

</div>

> [@markstos](#):
>
> Also, `ghost install` installs `.zip` files, and this workflow generates a `.tgz` file. It’s not even clear that it generates something that be installed directly.

Ghost CLI added support for installing from a tgz back in August: [Release 1.22.0 · TryGhost/Ghost-CLI · GitHub](https://github.com/TryGhost/Ghost-CLI/releases/tag/1.22.0)

---

<div class="post-metadata">

**Author:** ![satonotdead](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/satonotdead/32/33666_2.png) [@satonotdead](https://forum.ghost.org/u/satonotdead)\
**Post date:** [February 7, 2023, 4:19am UTC](https://forum.ghost.org/t/how-to-fork-when-self-hosting/33921/5 "2023-02-07T04:19:04Z")

</div>

OK I don’t really understand how to use Actions but I think I can use old school method:

```auto
# Rename origin to upstream again
git remote rename origin upstream

# Add your fork as an origin, editing in <YourUsername>!
git remote add origin git@github.com:<YourUsername>/repo

```

Is that correct? 🙂

---

<div class="post-metadata">

**Author:** ![markstos](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/markstos/32/18182_2.png) [@markstos](https://forum.ghost.org/u/markstos)\
**Post date:** [February 9, 2023, 1:43pm UTC](https://forum.ghost.org/t/how-to-fork-when-self-hosting/33921/6 "2023-02-09T13:43:55Z")

</div>

That syntax adds your repo as git’s origin repo, but to understand if that will help you, you need to post the whole solution you are trying.

---

<div class="post-metadata">

**Author:** ![satonotdead](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/satonotdead/32/33666_2.png) [@satonotdead](https://forum.ghost.org/u/satonotdead)\
**Post date:** [February 9, 2023, 3:50pm UTC](https://forum.ghost.org/t/how-to-fork-when-self-hosting/33921/7 "2023-02-09T15:50:42Z")

</div>

I wonder if can I change the origin and then pull my own repo to keep Ghost forked?

_(I understand that I need to mantain my own fork and keep it updated)_

---

<div class="post-metadata">

**Author:** ![markstos](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/markstos/32/18182_2.png) [@markstos](https://forum.ghost.org/u/markstos)\
**Post date:** [February 9, 2023, 4:14pm UTC](https://forum.ghost.org/t/how-to-fork-when-self-hosting/33921/8 "2023-02-09T16:14:22Z")

</div>

Yes, it looks like you’ve got a Github Actions workflow that supports custom branches and you also have a custom branch.

I work with Github Actions a lot at work and it can be a tool that can be complex to work with at times.

Here I described a lower-tech way to maintain a fork that might be a good fit if you have a small number of changes:

> [@Is there any way we can modify the cookie name for "ghost-members-ssr"](https://forum.ghost.org/t/is-there-any-way-we-can-modify-the-cookie-name-for-ghost-members-ssr/33939/2):
>
> Are you familiar with creating patch files? You could do something like this: Before you patch the file, create a .bak of the unmodified version. Let’s say now you have file.js.bak and file.js. Generate a patch file: diff -u file.js.bak file.js\>my-changes.patch. Except, run this command at the root of the project. Create a small script which wraps ghost update and then applies your patch: #!/bin/sh ghost update patch -p1 \<my-changes.patch Now each time you upgrade Ghost, your patch will be r…

---

<div class="post-metadata">

**Author:** ![satonotdead](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/satonotdead/32/33666_2.png) [@satonotdead](https://forum.ghost.org/u/satonotdead)\
**Post date:** [February 9, 2023, 7:53pm UTC](https://forum.ghost.org/t/how-to-fork-when-self-hosting/33921/9 "2023-02-09T19:53:20Z")

</div>

We need to force-update language on e-mails. There are changes on 9 files but if I get how to fork and keep Ghost updated, I will edit more.

_Then I will try to do PRs on main but I don’t have 1/10 level you have folks, sincerelly_ 🙂

Thanks, I’ll try to get how to engage Github Actions with our fork.
