What is the best way to remotely edit a file using VS code?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



What is the best way to remotely edit a file using VS code?



Currently, I have two machines, one with Ubuntu in the company and one with Mac OS at home. Sometimes I would like to work at home while accessing the Ubuntu machine in the company. I can ssh into the Ubuntu machine and navigate and compile there. However, when I actually want to edit some cpp source codes, I realize that the editor (VS code) is actually opened in the Ubuntu machine, so I cannot view it from Mac. What should I do if want to edit files remotely on my Mac through VS code?



Though many of the answers mention using version control tools like git, it can be hard to use in my specific case. The problem is that the building environment of my company is Linux, so most of the building tools I have can only run on Linux. This means that I can only compile my source codes in Linux. If I use git, then every time I want to compile and debug my codes, I have to commit and push with my Mac, and then pull and test on Linux. This can be time consuming if want to incrementally modify, test and debug my codes.





Try out rsync. That way you can sync your project files from remote to local, in order to work in real-time. Also, if you're going to use GitHub, you can check out exlcode.com/ide which is an online version of VS Code that's integrated with GH -- I may be a bit biased though as I'm a contributor to EXLcode :)
– svarlamov
Aug 6 at 6:05


rsync





What kind of file are you editing? Is it some source code?
– Basile Starynkevitch
Aug 6 at 6:16





Yes, it is some source code.
– q_WEASDZ
Aug 6 at 6:51




1 Answer
1



Use some version control system like git. Then you might edit and compile at home (provided your code is portable between Linux & MacOSX, e.g. because it is POSIX compliant).



You could install some X11 server on your Mac and use ssh -X to access the remote Ubuntu machine (then run a GUI or editor remotely, e.g. ssh -X remotelinuxhost.company.com emacs). However, that requires good bandwidth and latency between your home computer and the remote one.


ssh -X


ssh -X remotelinuxhost.company.com emacs



BTW, you might use some other source code editor, like emacs (it is capable of remote editing) or vim.



Since Linux and MacOSX are both POSIX systems, it is usually (but not always) easy to port source code from Linux to MacOSX and write source code compilable on both systems. BTW, many Linux frameworks (e.g. Qt, GTK, POCO, Boost, etc...) and build systems are usable and ported to MacOSX. Some Linux system calls (listed in syscalls(2)) are not available on MacOSX (e.g. signalfd(2)...)



Of course you could install Linux (perhaps inside some VM) on your Apple laptop.





Thanks for your answer! I am currently using git, but the problem is that the source codes I have on Ubuntu can only be compiled on Linux. Nevertheless, I will definitely try with X11 and source code editors.
– q_WEASDZ
Aug 6 at 6:56





Please edit your question to explain what kind of source code do you have that can only be compiled on Linux. Notice that MacOSX is mostly POSIX compatible (like Linux is), so in many (but not all) cases you can quite easily port a Linux source code for MacOSX
– Basile Starynkevitch
Aug 6 at 7:00






Sorry for the confusion here. The source codes I have are cpp source codes. The main problem I have is that the building environment of my company is Linux, so most of the build tools I have can only run on Linux.
– q_WEASDZ
Aug 6 at 7:09






Most of Linux build tools are free software and many of them are ported to MacOSX
– Basile Starynkevitch
Aug 6 at 7:11





Thank you for pointing out the compatibility between Linux and MacOSX. However, the build tool I use is specifically tailored by our infrastructure team. I think I might be able to get it working for MacOSX, but I believe it would involve some very significant works.
– q_WEASDZ
Aug 6 at 7:12







By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard