Skip to content

Technical Guide to Clone a Public Repository into a Private Repository for FinTorch

Marcel Boersma edited this page Mar 1, 2024 · 1 revision

To create a private version of the public FinTorch repository for personal or company-specific modifications, follow these steps:

Step 1: Create a Bare Clone of the Repository

First, create a temporary bare clone of the FinTorch repository. Perform this step in any directory, as it's temporary.

git clone --bare https://github.com/AI4FinTech/FinTorch.git

Step 2: Create a New Private Repository on GitHub

Go to GitHub and create a new private repository named FinTorch. If you're unable to create a private repository, consider applying for GitHub's Student Developer Pack for unlimited private repositories if eligible.

Step 3: Mirror-Push the Bare Clone to Your New Repository

Next, push the bare clone to your newly created private repository using HTTP. Replace <your_username> with your GitHub username and <your_repo> with your repository name.

cd FinTorch.git
git push --mirror https://github.com/<your_username>/<your_repo>.git

Step 4: Remove the Temporary Local Repository

After mirroring, remove the temporary local repository created in step 1.

cd ..
rm -rf FinTorch.git

Step 5: Clone Your New Private Repository

Clone your new private FinTorch repository to your local machine for development. Replace <your_username> and <your_repo> with your GitHub username and your repository name, respectively.

git clone https://github.com/<your_username>/<your_repo>.git

Step 6: Optionally, Track the Original Repository

To keep your private repository updated with the original FinTorch repository, add the original as an upstream remote. Disable push to upstream to avoid accidental modifications.

cd <your_repo>
git remote add upstream https://github.com/AI4FinTech/FinTorch.git
git remote set-url --push upstream DISABLE

Verify your remote configuration:

git remote -v

You should see your fork as origin and the original FinTorch repository as upstream with push disabled.

Step 7: Syncing Changes from Upstream

To update your private repository with changes from the original FinTorch repository:

git fetch upstream
git rebase upstream/main

Resolve any conflicts that arise during the rebase process.

Following these steps, your private FinTorch repository will be set up and ready for development, allowing for both contributions to the open-source community and proprietary modifications without affecting the public source.