Jump to content

How To Create A Private Fork For Intersect - Protecting Your Private Customizations!


Beefy Kasplant

Recommended Posts

Available in PDF format here: https://kasplant.itch.io/kash-shop-private-repo

The Issue

How forks currently work with GitHub, when you fork a public repository, you cannot make your fork private. Why is this an issue? Well, when you create a fork from the Intersect repository, the entire code to your game is made public. Not only is this of course a security risk, but any systems and code unique to your game is now available for others to obtain.

ef331eede292b236ccc2636071942a2a.png

4d01cd8d92dc6648dbd7d77d7c47b134.png

There Is A Solution!

There is no need to worry! There is a work around for this problem! With a few simple steps you can protect your code. This tutorial will walk you through making a making a private fork of Intersect, but still allow you to pull code changes from the Intersect main repository to stay up to date.

Getting Started

First, we need to do a little setup work.

  1. Open Visual Studio as Administrator

  2. Open NuGet Package Manager Console
    9b5b0e5bc25e90fccd3792c88bc9cf94.png

  3. Set directory of where you want your project files on your computer. Example:
    a46e37d2760a71df692dd47488d4e1f2.png

 

Create A Bare Clone

Now that we are looking in the right place, lets setup our private fork. First lets setup a bare clone. This will be deleted later.
38b6b5f1097d639b01e087f72b178c10.png

 

You should now see a folder named “Intersect-Engine.git” in the directory.

Create A Private Repository

Now create a private repository through GitHub. This will be where your code will be stored.

  1. Log into GitHub

  2. Under the “Repositories” tab. Click the green “New” button
    c59c47cffcd4bcc7437cf2530c4826ca.png

  3. Set the repository name to the name of your game and mark it as public. Then press the green “Create Repository” button at the bottom.
    052c8623dbd659e600a3ee3c69bd3ba6.png

Connect Temporary Clone with Repository

This step is where most of the magic happens. We are going to push our clone into our new private repository so GitHub will treat our new private repository as a clone.

  1. Back in Visual Studio, move into our clone folder
    1742c4420d65a39cec2b44a03dc78451.png

  2. Now push the clone into our new repository
    539cb93e7e1827f11d8beb26529cb4e3.png

Format: git push –mirror https://github.com/<your_username>/<repo_name>.git

If you look at your repository on GitHub. You should now see all the Intersect Engine source code in your new private repository.

Remove Temporary Repository

As mentioned earlier, it is now time to delete the bare clone as it has served its purpose.

  1. In Visual Studio, navigate back a folder
    a46e37d2760a71df692dd47488d4e1f2.png

  2. Delete temporary clone. Type “A” and press the ENTER key.
    ff72492c9415dcb03863daa249eb26ce.png

    Copying Repository to Local

    Now its time to pull our source code to our machine.
    1aeebee1271fd3053d7521e338afe0f9.png

    Format: git clone https://github.com/<your_username>/<repo_name>.git

    You should now see your repository copied into your directory.

    Preparing for Future Updates

    Since Intersect is still in development. We want to stay up to date and pull all future changes to the engine. To do this, we have to tell git where to pull from.

    1. Open project solution of our new repository. (.sln file)
      c27a3491d6bdf2dc0018fca520f7b5c3.png

    2. Open NuGet Package Manager Console
      9b5b0e5bc25e90fccd3792c88bc9cf94.png

    3. Create connection to main Intersect Repository
      2d0b1dfa9673e95d5b6594b490773114.png

    4. Even though we can not push back to the main Intersect repository, lets just disable it anyways.
      3ab9333c4eece83aa38d99d647bd9062.png

    5. Double check our remotes.
      5765f59d4744c89a46ba0edb9bcc6498.png

      Should see something similar, but with your information for the bottom two.
      4c2e0c8d72df349bc083edf29519c60d.png

    6. Do initializing fetch to the main Intersect repository
      fb77aeca2364d37bfe11946bd52edbda.png

You did it! You now have a private fork!

How To Pull Future Updates

Since Intersect is in development, pulling changes and staying up to date is important. Here are the steps to pulling changes into your project.

  1. Open the Team Explorer window
    2006c27b7bad3cba5120633a4ce1ace9.png

  2. Press the “Branches” button
    e40187f3a6ee23dc68106c571446e6a6.png

  3. Make sure you are on the right branch you want to pull changes into. In this case we will stay on the Master (Stable) branch. (Highlighted branch, double click to switch)
    e762d1c63d635558d33de580e26b94d0.png

  4. You will see in your remotes folder; you have two other folders.

    “origin” is your GitHub repository connection/branches

    “mainstream” is the GitHub main Intersect repository connection/branches

  5. Right click the branch name and select “Fetch”
    b2c2957568fc4f3686835b18964f1c52.png

  6. Rick click the branch name again and select “Merge From…”
    f378137b814253d526a456c3f7224923.png

  7. In the “Merge from branch:” select “mainstream/master” in this case since we want to pull changes from master branch in the main Intersect repository.

NOTE: Pay attention to the “Commit changes after merging” check box. It is up to you and your current development if you wish to commit not only the changes you just pulled from master, but any changes you may currently have in your solution.
a5c3810d8f567087120a94d3b1dac2c9.png

Your branch is now up to date with the Intersect main repository!

Conclusion

Thank you for following along with this tutorial. In this tutorial you have created a private repository/fork of Intersect Engine GitHub source and established connections back to the main repository. It also explained how to pull new changes into your project to stay up to date with the development of the Intersect Engine. Your source code is now protected from unwanted viewing eyes and to keep your development private.

Support

If you have questions, join our Kash Shop Support discord

Our Itch.io Store

We are constantly working on new patches and source code updates for Intersect. Check out our store at https://kasplant.itch.io

Edited by panda
Copying PDF into this thread so it is searchable and can be pinned
Link to comment
Share on other sites

  • panda changed the title to How To Create A Private Fork For Intersect - Protecting Your Private Customizations!
  • panda pinned this topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...