Prerequisites

  1. Initialise the repository using git init or VS Code

  2. Download the Unity .gitignore at https://forge.joshwel.co/mark/common/raw/branch/main/Unity.gitignore

  3. Download the Unity .gitattributes file at https://forge.joshwel.co/mark/common/raw/branch/main/Unity.gitattributes

  4. Place them at the root of your Unity Project folder

    School Projects
    └── **Your Unity Project (Master)**
        *(forge.joshwel.co, git-lfs + gitattributes)*
        ├── .gitignore
        ├── .gitattributes
        ├── Assets
        ├── Library
        ├── Logs
        ├── Packages
        ├── Packages
        ├── ProjectSettings
        ├── UserSettings
        └── ...
    

Steps

  1. Initialise Git LFS

    git lfs install
    
  2. Add files if you haven’t already

    git branch -m main
    git add *
    git commit -m "Initial commit"
    
  3. Make a repository at The Forge, leave everything as default — we’ve already made a .gitignore and .gitattributes. If you want a README.md, add it later through VS Code or your editor of choice, and then commit it to the repository as its’ own commit.

  4. Add the forge as a remote and push!

    <aside> ⚠️ if the project has a github deliverable, you must have different remote names! i would recommend origin pointing to github, and forge pointing to the forge

    </aside>

    git remote add forge <https://forge.joshwel.co/><username>/<repository>.git
    git push forge main
    

    If all goes well it should look something like this:

    $ git push -u forge main
    Uploading LFS objects: 100% (886/886), 2.9 GB | 45 MB/s, done.
    Enumerating objects: 4641, done.
    Counting objects: 100% (4641/4641), done.
    Delta compression using up to 16 threads
    Compressing objects: 100% (4637/4637), done.
    Writing objects: 100% (4641/4641), 51.45 MiB | 7.90 MiB/s, done.
    Total 4641 (delta 2185), reused 0 (delta 0), pack-reused 0 (from 0)
    remote: Resolving deltas: 100% (2185/2185), done.
    To <https://forge.joshwel.co/mark/stld-asg1.git>
    * [new branch]      main -> main
    branch 'main' set up to track 'forge/main'.
    
    

    Where there is a line for Git LFS (Uploading LFS objects: ). If you don’t see it, either:

    1. You’re not using a URP Project (of which will always have at least 1 Git LFS object) and have no beeg files,
    2. or, something went wrong… (;′⌒`)

I previously didn't have a .gitattributes file / I already have a Git repository - what now?

oh well, give up. conversion is a very involved process, and git is scary.

if anything, use the current folder you have as your Copy project folder, and then copy your Unity Project files into another folder of which you will use as your Master project folder.

basically you done fucked up for git lfs, but as long as it can be pushed to github then teach will be happy …but if you want to use the forge as a backup, treat your repo as the Copy project

what do the “Master” and “Copy” project folders mean? see:

Mirroring a Unity Project into both The Forge and GitHub (for Immersive Media Projects)