I’m not sure if you can bring your own machine[1] with GitHub Codespaces, but you can with Visual Studio Codespaces, which has the same underlying tech/featureset. (Visual Studio Codespaces was known as Visual Studio Online until last week) it basically does exactly what you want, let’s you use your dedicated local resources on another machine or remotely via the browser or using VS Code proper.
I work at Microsoft on Azure but not with VS Codespaces or with GitHub Codespaces — I’m just a big fan/user/beta tester.
[1]: https://devblogs.microsoft.com/visualstudio/bring-your-own-m...