Push Custom ERPNext to Github

I want to upload the production ERPnext that I have customized to GitHub, so that when I reinstall ERPnext I can install it directly from GitHub.
Is this legal to do and if so, can anyone help explain step by step how to do this?

Thanks in advance

Hello,

To do customisations and use it for personal purpose is totally fine according to the licence.
Secondly, I didn’t get it where exactly you want to upload it. To push customisations in your own repository. You would find it on Google. Please let me know if you still have further questions.

hello,
Thanks for the answer.
Yes, i want to use it for personal purpose.
i mean i want to upload all the frappe/erpnext folder that include my custom script to github, so anytime if i want to install it i just need to run : bench get and install from my repository.

Create an custom app, and put your custom changes in your app is the right way.
Change the core file in frappe/erpnext will be overrided when you update