If you need to create a copy of an existing website and put it in a subdomain as an archive, while retaining the Git history and deploying it to a new GitHub repository, you can follow these steps:
- Copy the website folder into a separate folder locally. In this example, we assume the website is a Hugo site.
- Open up the terminal and navigate to the copied site folder.
- Run the command
git remote -v
to list the existing GitHub repository as the “origin” remote. - Remove the “origin” remote by running
git remote rm origin
. After executing this command, runninggit remote -v
should return nothing. - If you use GitHub Desktop, simply drag the folder into the application. This will allow you to create a new GitHub repository from the copied site folder.
By following these steps, you can successfully remove a Git remote and create a separate GitHub repository for your copied website.