Transferring a local Hugo site to new laptop and re-establishing github link

So, I have Hugo set up on my computer and a local version of my site installed which I can view through localhost. I also have the site being hosted through github and deploy local versions through a (from the Hugo site) command.

I am getting a new computer and I am unsure how to reconnect to github. As a test I created a virtual machine on my current computer, installed Hugo, copied my local files across and know that I can view the site through local host. However, the does not obviously work.

Does anyone have a suggestion on the best way to reconnect the local version to the github version (content of both will be the same) and/or the git commands which I should use? I am also not sure whether I should just delete the github version and then push the local version through again. Thank you for any suggestions… even if it is to point me towards a resource… I have looked!

git clone https://...

The URL is here:

OK, thank you for that… And rather straight forward!! I’ll give it a go. I think I was just worried that the local version had more folders etc than the github version which basically just has the public version from the local copy… If that makes sense! I’ll just make sure I keep a back-up.

Thank you again and appreciate the quick response.

An empty folder is not added in git by default! So you have to add it or touch an hidden file in the directory…

Hi, just thought I would give an update on transferring my local Hugo site to a new computer and re-establishing the connection with GitHub. It might be of use to someone else or someone might be able to tell me if there is a quicker/cleaner way to complete the task. To recap, I have a local Hugo site on my computer which pushes changes to GitHub using the Hugo script found here. The steps I went through:

  1. Created a copy of my existing local site folder. I know there will be various ways to do this but for me I simply copied the whole of my blog folder over to Google Drive.
  2. I then installed Hugo on my new computer.
  3. Created a new Hugo site called blog (i.e. hugo new site blog) and then deleted the contents from the folder.
  4. Downloaded the saved folder from Google Drive and copied the contents into the newly created (empty) Hugo blog folder.
  5. In the blog folder I then ran the following commands:
$ git init
$ chmod +x
$ rm -rf public
$ git submodule add -b master<USERNAME>/< public
$ ./ "optional comment"

Everything seems to be working fine now with local changes being successfully pushed through to GitHub. The only other thing which I did at the beginning before making any of the above changes was to clone my local GitHub repository (git clone https://...) on to my computer… just in case I messed things up!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.