Skip to content

Setting Up Your GitLab Repository with GitHub Source

To clone a GitHub repo and maintain it in your own GitLab repository while periodically pulling updates from the original source, you'll need to set up multiple remotes. Here's a step-by-step process:

Initial Setup

  1. Clone the original GitHub repository. Using ComfyUI as example.

    git clone https://github.com/comfyanonymous/ComfyUI.git
    cd ComfyUI
    

  2. Create a new empty repository on GitLab through the GitLab web interface

  3. Change the remote URL to point to your GitLab repository:

    git remote rename origin github
    git remote add origin https://gitlab.com/your-username/your-repo-name.git
    

  4. Push your code to GitLab:

    git push -u origin main
    
    (Use master instead of main if that's the main branch name)

Making Your Changes

  1. Create a branch for your customizations:

    git checkout -b my-customizations
    

  2. Make your changes, commit them:

    git add .
    git commit -m "Add my custom features"
    

  3. Push your changes to GitLab:

    git push -u origin my-customizations
    

Updating with Changes from GitHub

  1. To pull changes from the original GitHub repository:

    git checkout main  # or master
    git fetch github
    git merge github/main  # or github/master
    git push origin main  # Push the updated main branch to GitLab
    

  2. To apply GitHub updates to your customized branch:

    git checkout my-customizations
    git merge main  # This merges the updated main into your custom branch
    # Resolve any merge conflicts
    git push origin my-customizations
    

Alternative Workflow

If you prefer to keep your customizations on the main branch:

  1. After initial setup, make your changes directly on main
  2. When you want to update from GitHub:
    git fetch github
    git merge github/main
    # Resolve any conflicts
    git push origin main