15 ms·
Ask HN: Best practices for editing remote code locally?
Working on a remote codebase from a local computer accessible via ssh, what’s the best/easiest way to write, edit and test code?
- aardvark179 5y agoEmacs tramp can edit files over ssh very nicely, along with other things like editing files as another user through sudo.
- andi999 5y agoWhat is wrong with using ssh -X and the do the same workflow you would do if you were on premise?
- hexo 5y agosometimes it is just too slow or laggy. some software even refuses to run at all that way.
- bayindirh 5y agoBecause we don't have gigabit symmetrical lines everywhere.
- yeetsfromhellL2 5y agoI've done X forwarding over slow wifi and it worked great. OP isn't editing video.
- bayindirh 5y agoI'm doing X forwarding for 15 years and unless you have ~20mbps symmetrical lines, you can't do anything productive. However, if you absolutely must, use X2go.
- yeetsfromhellL2 5y agoI certainly haven't used it that much, but I never felt like the connection quality was a huge concern for a usable DE. It's something like 30 years old now isn't it?
- bayindirh 5y agoThe thing with X11Forwarding is, it's never designed to be ran over WAN or, slower connections to be precise. It carries X11 commands, not the video itself and is synchronous and doesn't compress anything. As a result it both needs low latency and saturates connections quickly. When the updates are occasional, fine, but when you call make or run something which updates fast/creates a lot of output, things get hairy, quick. Even on local networks with a couple of connections. Been there, tried that, experienced it all. X2Go transmits the image, compresses it, and can work with much slower and higher latency network connections. It can also resume sessions.
- aardvark179 5y agoIt depends a lot on the application. Old apps that use old X fonts etc. work okay-ish, but by default a lot of modern apps will be pushing too much over the connection because they'll be doing the font rendering into a buffer.
- throwaway71271 5y agolocal emacs + TRAMP works really nice
- R0flcopt3r 5y agoTRAMP has been too slow for me, and I've never had a reliable LSP session over it. Tried both eglot and lsp-mode. eglot is the better of the two for this. I ended up creating a "runtime" script that first rsync all the files over to my remote machine, then run whatever arguments, `runtime <host> 'make'`. there are some flags too like `-s` to have it not rsync, etc. This works very well. But then this is maybe cheating since my code is still local. The reason for this is my M1 mac can't build our gigantic C++ code base for a whole host of various insane reasons.
- dhosek 5y agoI've had good luck with Tramp+Aquamacs myself. There might be a short delay at save time, but I can live with that.
- ryangittins 5y agoAn important tool to find or write is one which will automatically sync your changes made locally (from the comfort of your IDE of choice) to the remote machine every time you save it. You want to be able to iterate quickly and not have to manually run a command every time you want to sync changes. It's also a huge help to tie this into a way to run the unit tests for files which have been changed so you can get feedback and quickly as possible. Ideally, everything should be made so automatic that you barely even notice the code isn't running on your machine.
- pbsds 5y agoFor this i combine entr and rsync
- gotts 5y agolocal code editing + rsync command that you run manually or automatically(e.g. using fswatch)
- evocatus 5y agoSSH in and use a terminal editor. Or, create an SMB/CIFS share and mount it locally.
- dezmou 5y agoI am used to work with "remote - SSH" vs-code extension with a remote server and it work like a charm, you can't tell that you are not at home. I do all my coding this way BTW
- chrisshroba 5y agoCan you elaborate on the situation? Personally I’d just keep a local copy of the code and then use git or rsync to sync the remote system to my local version whenever I’m ready to. If it’s just small things like a quick config change or something, I’d personally just ssh in and modify with vim. For testing, you probably shouldn’t be doing that on a production system, perhaps you could stick the code in a docker container and run the tests locally? If you’re familiar with docker, that shouldn’t take more than a couple hours to set up, and likely much less time than that if the project isn’t super complex. Feel free to explain your use case further and I bet people could give more targeted advice!
- deleted 5y ago[deleted]
- lyrr 5y agoSince you seem to know what you’re talking about, I’m looking for some advice: I work for a large and very well known engineering company and currently our incredibly terrible workflow looks something like this: Develop locally using VStudio -> transfer repo to network drive -> login to tester via three layers of Remote Desktop Connections -> run and debug code live on tester RDC The tester setup is virtually all GUI based. It’s also located on the other side of Asia which is the reason of logging in via RDC. Is there possibly a better way of making this workflow more contained in a terminal/single ide environment, without having to jump through the RDC loops?
- chrisshroba 5y agoI'm no networking wizard so this isn't really my area of expertise but I have a few thoughts and questions. Why do you need three layers of RDC? Is this due to networking constraints, where the ultimate server (I'll call it the prod server) you are trying to reach is unreachable from the internet directly? You might be able to tunnel into the server using ssh tunnels (see this guide [1]) through an intermediate server which your computer and the prod server both have access to, and then you'd be able to directly scp or rsync files to the server, as well as run commands over ssh, but this would be increasing your attack exposure from a security perspective, which folks may not be happy about since you're at a large engineering company. A few questions that would help me give more actionable advice: What is the "tester" you're using? Is it essential to interact with it via a GUI or does it have a command line interface you would prefer to use? Is the OS Linux or Windows? What are the the three layers of RDC? Feel free to email me at my hn username @gmail.com to discuss further since this is getting pretty specific to your setup! Sounds like a fun problem to try and solve :)
- bayindirh 5y agoI personally prefer Eclipse Remote Development Tools, which can either work via a dedicated daemon, or SSH.
- qsort 5y agogit? If it's impossible to clone the environment for some reason, VS Code and JetBrains IDEs have remote support. Even vim can edit remote files. It's not clear from your question what exactly is your problem, would you be willing to elaborate?
- paskozdilar 5y agoSince I like my local development environment, I mostly use `sshfs`. It mounts a remote directory onto a local directory and lets you access remote files as if they're local, with slight latency. Then you can use whatever tools you use locally to edit/compile/run the software.
- ufo 5y agoI also use this setup. Works well for editing and reading the files. But be aware that some file-intensive operations don't work as well. It is better to grep or git in the remore server instead of in the local mount. Be careful if your shell prompt is configured to show git status, because that won't be instantaneous.
- mekster 5y agosshfs works for only 10 files or less project.
- paskozdilar 5y agoHow so?
- mekster 5y agoNever do find in files or run package managers? JetBrains never works on sshfs as it parses files for dependencies.
- paskozdilar 5y agoActually, you're right. I just tested recursively grepping a remote directory with a thousand 16KiB files. The speed is completely catastrophic: $ time grep -r foo test ... real 7m36,154s user 0m0,110s sys 0m0,249s The average download speed from remote host is ~2MiB/s, so it isn't a network issue - a thousand 16KiB files sum up to 16MiB so it shouldn't take more than ten seconds. Seven minutes is terrible. I don't understand why is this happening. Is this an inherent limitation of remote filesystems or is sshfs implementation just sucky? EDIT: parallelization seems to help - running 100 concurrent reads at a time uses up to ~1MiB bandwidth. I suppose ordinary unix tools don't play well with remote filesystems because they do stuff sequentially. That being said, if JetBrains is struggling with SSHFS, then they really need to fix their file browsing code.
- jve 5y agoVisual Studio Code Remote SSH? https://code.visualstudio.com/docs/remote/ssh https://code.visualstudio.com/docs/remote/ssh it will however install VS Code Server on target machine. So, for permanent development it is good. Not great if you only want to change one config file in PROD environment. > The Visual Studio Code Remote - SSH extension allows you to open a remote folder on any remote machine, virtual machine, or container with a running SSH server and take full advantage of VS Code's feature set. Once connected to a server, you can interact with files and folders anywhere on the remote filesystem. Once connected, even terminal runs on remote host. Moreover you get to forward ports from remote host to local using VSCode UI.
- dezmou 5y agoIt also do a lot of other stuff, for instance, if you have a python linter that need the python binary to check code, then you can specify the python path of the remote machine and vs-code will use it for linting, work also with other langages like C. Also you can use embeded terminal and type "code myfile.txt" and it will open the file. If used with windows, it also automaticaly remap localhost to the machine if you are launching a local server with your terminal (can be annoying tho) Basicaly it try to do everything to make you feel that you aren't on a remote ssh connexion and it work really well
- samwillis 5y agoI have recently started using this for a project, I’m on a Mac and the legacy codebase only supports CentOS7… I have a VM setup on my machine and use VS Code to “remotely” develop on the VM. Works really well!
- captrb 5y agoI'm experimenting with using this VSCode feature to edit code on a Spark master, with the code storage on an EFS volume. So far, this seems to be allowing me to have a local-feeling environment, with a well-factored codebase that I can reference from a Jupyter notebook (inside VSCode), that has high-bandwidth and low-latency access to our data repositories. I can also choose to temporarily vertically scale the remote host if I want to run single-node operations (ie Pandas).
- jitl 5y ago- My preference is to run my IDE or editor on the remote, and only run a thin client (RDP > X11, mosh > ssh) on the local. Because I’m happy in nvim, I would just install nvim and my dot files on the remote and access it via mosh/tmux. But this is not for everyone; if you’re doing Java an IDE is a must. So, try RDP or X11 forwarding for those. If you can’t install software on the remote (or you can’t install a GUI stack), read on: - Most IDEs like Intellij can be configured to do all their execution on a remote over SSH. I worked this way using PyCharm for my student job at UC Berkeley in 2012 and it worked great. - SSHFS is okay but not great because of slowness. It’s fine for editing but sucks for running interpreted code locally. So, try to do all execution on the remote. - VS Code has handy support of editing on a remote without needing SSHFS - if permitted, a two-way file sync solution like Unison or Mutagen gets you native file system performance on the local. We used Unison for local editing with remote execution for Airbnb’s Ruby codebase for several years (2015-2018+). But it’s more fiddly to work with than SSHFS.
- paskozdilar 5y agoSSHFS caches reads on my machine. Here's a sequential timing of sha256sum operation on a ~10MiB file: $ time sha256sum file c2359f8b63dfef9f50e62b2e7b4ef2613c290c3a1ffa135cfa255b14eafd3ffb file real 0m5,205s user 0m0,127s sys 0m0,011s $ time sha256sum file c2359f8b63dfef9f50e62b2e7b4ef2613c290c3a1ffa135cfa255b14eafd3ffb file real 0m0,221s user 0m0,093s sys 0m0,004s That should be enough to prevent slowness for interpreted code, since textual files are small anyway. SSHFS only needs to send edited files to the remote machine.
- mekster 5y agoNo one wants to open up project files over sshfs... Do a search on all files and you'll need a break. Code parsing definitely can take forever using JetBrains.
- paskozdilar 5y agoDepends on the project size. My average project size ~12MiB - 19MiB when using vendor/ directory with Golang. It's less than a minute wait on a 1MiB connection to load the whole directory and cache it. For compiled languages, binary size would be a problem so it's probably smart to write the compilation output somewhere outside sshfs-mounted directory and run it locally. For interpreted languages generally it shouldn't be a problem since everything is in memory. Python does write stuff in __pycache__/, but in my experience it's rarely more than a few hundred kilobytes per cache directory; it's also possible to turn off writing __pycache__/ with PYTHONDONTWRITEBYTECODE=1.
- jpn 5y agoFor Sublime Text users, SFTP is super useful: https://codexns.io/products/sftp_for_sublime https://codexns.io/products/sftp_for_sublime
- jve 5y agoSomething super-similar is available for VSCode too: SFTP https://marketplace.visualstudio.com/items?itemName=liximomo.sftp https://marketplace.visualstudio.com/items?itemName=liximomo...
- hprotagonist 5y agoi use emacs+TRAMP for vcs, mosh for remote terminal presence, and vscode+ssh or jetbrains gateway for dev.
- blunte 5y agoI have recently built a dev server for myself using https://github.com/coder/code-server https://github.com/coder/code-server (VS Code in the browser, hosted on the remote server). With very little effort, you get an always-on dev environment with built in terminal so you don't even have to ssh in if you don't feel like it (if you're happy working within the editor's terminal window pane). As a bonus, I also setup openvnc, cloudflared (DNS over HTTPS), and pihole. And tmux and mosh of course. With this setup I can even do my work from an iPad (once you get the VPN setup correctly). It's nice to be able to reboot my laptop without losing my place in my work.
- qbasic_forever 5y agoYeah code-server is really nice and underrated as a remote coding option. The linuxserver.io docker container for it is super fast and easy to setup: https://docs.linuxserver.io/images/docker-code-server https://docs.linuxserver.io/images/docker-code-server
- yabones 5y agoIdeally, just use a text editor on the remote machine such as Vim, Nano, or Emacs. If you want a full IDE, or just your set of extensions & tools, you could install it there and use X11 forwarding like so: ssh -X me@box /usr/bin/code I believe VSCode also has a remote mode, but I haven't used it.
- lf-non 5y agoX11 forwarding was not a great experience last I tried it. Every now and then clipboard would stop working or resized windows would retain their original dimensions etc. Not entirely sure if it had to do with my setup or network. I switched to tmux+neovim a year ago and it has been a much better experience.
- pbsds 5y agoMany editors support the rmate protocol, enabling you to open a remote file from a ssh session in your local editor.
- michaelt 5y agoI've seen some of my colleagues running 'Visual Studio Code remote' [1] which allowed them to edit source code on a remote machine with a native text editor; run the code and tests remotely with a local interactive debugger, and so on. I haven't tried it myself, but they seemed to like it. [1] https://code.visualstudio.com/docs/remote/ssh https://code.visualstudio.com/docs/remote/ssh
- JamesMcMinn 5y agoVS Code + The Remote SSH extension is a remarkable solution to developing code (not just editing!) on a remote machine. When Covid hit and my main work machine was still a desktop, I worked from my home using VS Code and the remote plugin. This lasted for 18 months, and the only time I ever had an issue was due to a power outage in the office. Data, code (everything, really) lived on my work desktop that was sat in an empty office while I was at home. There's no latency, the terminal opens as if you were on the remote machine, and ports are automatically forwarded. It runs code, tests, etc. all on the remote machine. If there's a better solution out there it's almost certainly down to IDE preference.
- woopwoop 5y agoSeconded. It is so seemless that it is literally possible to not notice which machine you are on if you are just firing up something new for quick exploration.
- monkeybutton 5y agoI use VS code with the same plugin for working remotely. I also use jupyter lab with port tunneling and there's no difference to what it was like working locally. My company issued computer is just a VM off in some cloud. Working like this has a oddly retro-futuristic feel to it. Like we've gone back to the days of mainframe development.
- aldanor 5y agoJust a suggestion - VS Code (now) has a super nice support for jupyter. You don't have to start the server externally, vim mode and all your extensions like github copilot work fine, proper autocompleting works, etc. Debugging is absolutely amazing. I've recently switched myself and am never going back to browser-based jupyter.
- monkeybutton 5y agoDebugging jupyter notebooks, as in you can set a breakpoint then shift-enter to run a cell and hit it? I'll have to give that a try!
- hokumguru 5y agoNova (https://nova.app https://nova.app) has a remote file browser + terminal that I've found work surprisingly well, it has the advantage of being Mac native as well!
- ArcMex 5y agoThank you for sharing this. I will give the 30-day trial a shot. I find VSCode just fits my needs on my boxes (Mac, Win, Linux) but I am always open to try stuff.
- giobox 5y agoNova is nice, but its selection of plugins and integrations (things like linters, code syntax highlighting for specific languages etc) is just vastly behind VSCode. Mac native is nice to have, but the feature set in VSCode is so hard for a small competitor like Panic to beat now, especially when Nova is relatively exspensive. If you are purely doing web design work, I could maybe recommend Nova for its nice CSS/HTML tooling, but again you can recreate much of this with VSCode anyway. When you factor in Nova is 99 dollars this conversation becomes a lot more difficult when VSCode is such a strong free competitor. Nova has been through several iterations/product resets, I owned it back when it was called "Coda" too. VSCode by comparison has been relatively stable and its ecosystem a lot healthier. I'd actually recommend VSCode + another Panic Software app for remote file access on a Mac: Transmit. Transmit is mac native standalone remote filesystem access tool, its basically the tool they built into Nova as a standalone, and 45 bucks: https://panic.com/transmit/ https://panic.com/transmit/ VSCode + Transmit is IMO the best in class tools on MacOS for this kind of remote access work, although you can easily substitute Transmit for a free tool like CyberDuck or similar too and keep software cost at zero.
- mekster 5y agoVscode being free, I suppose the only real contenders are Sublime Text or JetBrains. Everything else either free or paid seem like a non option.
- Y-bar 5y agoIf you are on a Mac, using Transmit (https://panic.com/transmit/ https://panic.com/transmit/) you can mount a SSH/SFTP connection as a local disk and edit there in your editor of choice.
- mekster 5y agoDo people who work over sshfs never search for a string over all files? Or your editor wants to parse codes from all files to find dependencies etc? Save on upload of a local copy is far superior.
- rvieira 5y agoCouple of solutions (some already mentioned): - SSH remote editing (e.g. ssh + remote Emacs/Vim) - VS Code + Remote SSH - Emacs TRAMP - JetBrains Gateway - mutagen? (I haven't played with it, I'm not sure if it's suitable for your case)
- drewg123 5y agoOld unix tools like vi or emacs and "make" were built when nearly all computers were remote, and work really well for this. Especially when combined with something like "screen" to preserve multiple sessions..
- sillycube 5y agoI use atom and remote ftp plugin. With this setup, I can connect to my dev server with my local machines. 1 machine is Macbook air at home, another is windows in the office
- globular-toast 5y agoBest practice is to write, test, build etc. locally using a version control system and deploy a tested bundle to the remote computer when ready. Editing code directly on a remote server is something I used to do in the 90s before git and other tools made good practices much easier.
- ArcMex 5y agoOh, I love your response. Thank you. My workflow was as follows - Remote into server and develop from there - Git to different location, could even be same server - Occasionally pull on local machine for redundant backup This allowed me to - Segregate builds for my testing and the business's UAT - Allowed me to always have a stable build locally that I could look at from home Before, I did develop on my local machine and push to a server. Some part of me still thinks that's the proper way to do it. But I am always seeing what works best for the current situation and developing directly on my server served me well once upon a time.
- datalopers 5y agoBest practice changes rapidly, local dev environments have proven to be an endless pain in the ass. Apple M1 silicon is the final nail. The next 10 years of “best practices” will return to dumb clients and dynamically provisioned dev environments. It’s simply so much easier.
- TameAntelope 5y agoAs someone who has responsibility over how shitty the local development experience is for my org, I recently saw GitHub Workspaces and am curious if that could be a viable option.
- bluehatbrit 4y agoI've been using GH Codespaces for a side project when on the go for a while now. When I'm travelling or recently when moving house I've been able to use my terrible but light weight laptop with vscode + gh codespaces. It's been a complete dream! When running the same project locally on the laptop it's slow and makes development a real pain but codespaces has given the laptop a new lease of life. I'm not sure if the price lines up well enough for a daily-drive for a company, but if I were managing dev environments for an org these days I'd probably jump to something similar. Perhaps something like a decent size EC2 on AWS where devs can tear it down and spin it up again to start from scratch within a couple minutes. Throw away dev environments feels like a game changer having used it for the past 6 months on-the-go.
- zamalek 5y agoThe first few minutes of this video[1] shows a typical approach using containers with TTY editors. If you use VSCode then you can take a look at "Visual Studio Code Remote - Containers", if you use JetBrains products then take a look at "Gateway" or "Projector". [1]: https://www.youtube.com/watch?v=XOOBL3bhFHs https://www.youtube.com/watch?v=XOOBL3bhFHs
- motoboi 5y agoI have been using jetbrains gateway solution. I've seen lots of improvements but unfortunately it's still awful. I'm using mostly Visual Code + Remote SSH (which would be wonderful if visual code was a gread IDE, which it's not. A fine IDE, but not a gread IDE). For large java project I switch to Jetbrains Gateway, but the experience is too painful.
- gorjusborg 5y agoI love jetbrains for the indexing magic they do across their products, but yeah, the remote development last time I checked was lackluster.
- rubicks 5y agosshfs + $EDITOR
- Aperocky 5y agovim with good amount of plugin is my go to. My vim setup looks like atom in terms of interface: https://github.com/Aperocky/unix-setup/blob/master/.vimrc https://github.com/Aperocky/unix-setup/blob/master/.vimrc Very easy to setup, just add the .vimrc file and run the git clone commands after setting up pathogen (package interface). This setup is pretty nice to edit ts/js/py/rb and C family of languages (add plugin specific to language when you need it). This isn't just for SSH, this is my goto in local as well, but it behaves exactly the same either remote or local. This doesn't really work for any of the JVM languages however, those you probably want an IDE.. I tried my best in vim and it just don't work.
- lfkdev 5y agoVS Code with remote ssh. This is actually my default workflow. I always rent a small vps and work/code on it over the remote ssh plugin. Worke perfectly
- mjh2539 5y agoemacs-nox
- ddaalluu2 5y agoIdk if hn is psychic but I just thought how great it could be if I could use my workstation in the next room as a host for writing code on my phone. Because I can take my phone where I'm comfortable and hold it where I please and lay on the sofa, relaxed as opposed to sitting on a chair where blood flow to my feet is semi cut off. (How I would love one of those walk-apparatuses Linus Torvalds has). So sorry no answer, but also interested. I remember there were a few online code editors, but trust is an issue and they cost extra. The way you intend to use it though... I have done it in my PHP days, long ago. It's not good practice. Version control systems are a good invention, even if you sometimes just need a quick fix. Edit locally, push to repo, auto build or manually.
- icosahedron 5y agoI do this periodically with my iPad. I use Textastic which is a decent editor with it's SSH mode. There is also ShellFish, which is an iOS SSH file provider. You can use it to access any files via SSH as if they were from iCloud or OneDrive, etc. Lastly, there is code-server, which is VS Code in a browser. I've used this from time to time, and it works well.
- ilovecaching 5y agoThe answer is so incredibly simple. SSH to the machine. Start vim or emacs. The end.
- mekster 5y agoWhat if one wants to use other GUI editors?
- louissan 5y agovi?
- IE6 5y agoIs it possible to work locally doing all the fun stuff in a kind of "stage" env and then push via scp or some other ssh based mechanism to the remote?
- kkfx 5y agoIf it's a serious, non casual/on-the-spot usage work on a local copy and sync it, it does not matter if it's a repo or something you rsync/unison that's the top performant, comfortable and safe way. Networked computing does not means do anything via network and desktops are not despite all tentative in this direction "endpoint" or modern dumb terminal of a remote mainframe-alike server. If it's casual edit you need to do ssh is enough, via TRAMP (who can work on various protocols transparently, not just ssh) if you are in Emacs or perhaps with sshfs for an editor-neutral solution (knowing it does not offer a full POSIX fs). For testing again ssh is a very common and friendly option.
- ghishadow 5y agoLapce (lapce.dev) remote development is pretty good, I wish Sublime Text has something like that, Lapce also has good integration with WSL. I tried Vscode but it doesn't work on Firefox level codebase.
- dncornholio 5y agoI think we have a XY problem[1] here. Could you explain more details please? Writing, editing and testing on a remote machine seems like a bad practise. [1]: https://xyproblem.info/ https://xyproblem.info/
- emacs28 5y agoI use Emacs but don't enjoy the latency of using a remote Emacs session or locally using tramp. Recently my solution is to edit locally, then whenever I need to run the codebase on the remote machine I wrap the run command in a script with two rsync commands. First (using rsync) it will sync the remote codebase with any local changes. Then when the remote command completes, any relevant result files I want to analyze locally after are synced back to the local machine (using rsync). Rsync is very flexible and has lots of options such as ignore filters.
- ctur 5y agoCheck out mutagen (discussion on https://news.ycombinator.com/item?id=30957156 https://news.ycombinator.com/item?id=30957156) -- it basically does bidirectional, background, transparent rsync. It also does port forwarding if you need that. It looks quite solid for the use case you describe.
- rank0 5y agoDon’t overthink it! Keep it traditional baby all you need is vim and tmux. The initial learning curve for these sorts of cli apps is a bit steep, but it’s a lifelong skill and easily learnable for any competent developer. Writing code is 1000x more difficult than learning vim philosophy and memorizing some key bindings. Since I do all my editing in terminal, I just have a portable environment in a git repo. It has an install script that soft links all my scripts and config files to the appropriate locations. My work environment comes with me everywhere!
- alkonaut 5y agoSo just because the code is remote one should edit in a terminal? Seems like the lowest common denominator, but a pretty bad one. And on Windows (the most common OS, even among developers) this is pretty painful even with WSL. As far as lowest common denominators for tooling goes, "terminal window" is pretty low.
- jdauriemma 5y agoI think they were commenting on the portability of terminal-based applications and describing remote editing as a use case. You may think it's "bad" but it's also ubiquitous, resource-efficient, and free. Can you explain to this non-Windows user why vim+tmux is painful in Windows (with or without WSL) in a local or remote setting?
- alkonaut 5y agoI think it's painful because terminals and ssh are just second class citizens. Dotfiles, ssh key storage etc are just not a first class concept (at least not in the same way as on linux) etc. And also things like clipboards don't work - which to a linux user might seem like a non-issue (It just never worked well) but that's a much more painful experience if you are used to it working.
- jdauriemma 5y agoClipboards can be a hassle, for sure. Can you help me understand the impact of dotfiles / ssh key management not being a "first class concept?" How much of a time / productivity hit do you take? Thanks so much for helping me understand.
- unmole 5y agoMosh + Tmux + Vim
- warent 5y agoI host my code on a server because the docker-compose required to run the whole stack takes more memory than my macbook can afford (Docker is very memory hungry on Mac and at the moment I "only" have 16gb). Basically just hosting an SMB server and then mounting it as a volume on my work computer. So it looks like a normal folder/directory but it's over a network. You can also get fancy and configure your NAT to only allow this over local connections, then spin up a VPN. In this way I'm able to securely work in my server from anywhere.
- ipaddr 5y agoYou can still use dreamweaver mx, 7, etc. You can use intellj products Sublime ssh plugins, vs plugins On android you can use AWD - editor
- honkler 5y ago`sshfs`, to mount a remote directory locally, then edit it with whatever tools you want.
- martopix 5y agoI use Atom with an extension called ftp-remote-edit that works quite nicely.
- yangosoft 5y agoTry NetBeans, works quite well for remote projects using SSH. Also found vscode + remote SSH very useful, as others users recommended.
- _wldu 5y agoThe most secure way to do this would be to run Qubes OS [1] and use a qube dedicated solely to your software development. You can do your random web browsing and other risky Internet based things (such as email) in other qubes (not your dev qube). IMPO, isolation is really the best defense we have against modern attacks (supply chain, water hole attacks, whale phishing, etc.) Hope this helps. [1] - https://www.qubes-os.org/ https://www.qubes-os.org/
- Jaruzel 5y agoAs a Windows guy who uses Linux on servers only, I used to install samba onto the servers and map a drive to that (over a hardware VPN). These were servers that I had full control over. I'd use an IDE on Windows and directly edit the code. Save, reload in Browser, see changes. Now due to changes in where I host my stuff, I can't do that anymore, and I'm struggling to find a simple solution. I have recently discovered that WinSCP can 'edit' a file by pulling it locally into a temp folder, opening your IDE of choice, and then auto resyncing the file to remote server whenever the local copy changes. It's OK as a workflow, but not as flexible as having an open folder to just drop stuff into. I know the latest version of Dreamweaver has the same sort of thing built in which would be better... But as a hobbyist, I just can't afford that.
- mekster 5y agoCopy project files locally and upload on save? This is just so simple and performing, not sure why anyone is struggling with other worse solutions. The only better method would be vscode remote editing plugin.
- maicro 5y agoWhile there are plenty of other more powerful solutions suggested here, I prefer my fairly light weight option - WinSCP connecting to the remote server over SFTP, then opening the files I want to change in my preferred editor (Sublime Text). WinSCP handles uploading file changes to the remote server automatically; there might also be a way to trigger actions on upload, but that gets into specifics of how your codebase is setup / what you need to run to test changes. Bonuses of using WinSCP are drag-and-drop file transfers, and a pretty thorough site manager (/address book / credential storage / login manager, whatever you want to call it).
- Jaruzel 5y agoHeh, I basically said exactly the same thing elsewhere in this thread and got voted down. I guess someone out there doesn't like WinSCP! (I'm voting you up, as I can't vote myself up)
- maicro 5y ago...there's no accounting for taste? It really is a great solution as long as you understand the limits - there are more powerful options, but this one is just so quick and easy to get set up if it's valid for your situation.
- tpoacher 5y agossh + byobu + your favourite terminal editor. bonus: collaborative coding by attaching to the same byobu session as your colleague
- ChuckMcM 5y agoThat the answer isn't "well you just tunnel X11 and bring up your regular work flow." is interesting to me. Because for literally decades this was a completely solved problem. That it is a question always makes me wonder what was in it for the purveyor's of OS software to make this so impossible to do.
- rank0 5y agoMacOS appears to make this intentionally difficult. I've tried with stuff like xQuartz but its finicky and Apple is extremely hostile to non-apple interoperability.
- Steltek 5y agoAchieving tunneled X applications is not hard, as you said it's a solved problem, but I have never found it worth the effort either. 1. VNC has a "stable session" that doesn't collapse when SSH closes. Even between Linux machines, I chose VNC when needing a permanent remote GUI. 2. Remote machines don't always have your preferred applications or the associated preferred configuration. Copying a light .vimrc was always easier than trying to export-import a heavier app. 3. Performance always sucked. Even between machines sitting next to each other. 4. I didn't edit files with a GUI app anyway. Didn't everyone just use Vim, Emacs, or Nano? Was remote GUI apps ever anyone's preferred method (X11 or not)?
- ChuckMcM 5y ago4.) I typically just spawn a few xterms (edit, build/debug (typically using screen), and i/o). 3.) No, performance has been fine using X11 apps that were built with X11 in mind (vs Wayland or some sort of locally accelerated GPU helper(do you really need 25% transparent dialog boxes?)) 2.) There is remote machine I own/control (it has all the things I need) and going into a system that someone else has asked me to develop on (then ANSI terminal tools over SSL are always working) 1.) VNC has always been hit or miss for me, I do typically use screen(1) to keep sessions alive if for some reason the network dies in the middle. But all fine points.
- qbasic_forever 5y ago
- jraph 5y agoKate is a fantastic code editor (if you don't need an IDE, though it gained support for LSP) and is able to edit files over SFTP (without having to mount anything with SSHFS, which would be less efficient anyway because Kate would not be aware it is editing a distant file this way). KDevelop can probably too, and it is an IDE. I'd try QtCreator too. In the same vain, Gedit and its forks can do this to if that's your cup of tea. or vim, emacs or nano through a traditional SSH session :-)
- mekster 5y agoDoes anyone seriously use nano for programming? Also I'd probably get pissed for using vim over ssh session to program when sometimes the network could sporadically slows down my cursor movement.
- jraph 5y agonano is a surprisingly capable code editor. I like using it for quick edits or when I'm on a remote server. It's indentation can be configured (tab or space, how wide), it has optional line numbering, undo / redo, copy/paste (line based or more fine-grained), a very efficient search and replace that can cross files, syntax highlighting (a bit limited at times). It's fast. I know how to use vim and like it but haven't become proficient with it and its modal editing still gets in my way. I haven't tried Emacs. I have written sizable chunks of code with nano. I usually prefer Kate most of the time though. I've tried VS Codium but I find it too sluggish. I'd use it for some refactoring tasks but with Kate gaining LSP support (and true multi cursor mode), I have even less incentive to use Codium now. My muscle memory has been trained with Kate for 15 years now. Rachel from rachelbythebay.com notoriously uses nano FWIW [1] If you don't expect a very powerful editor, nano can be a good companion, but it is actually more powerful than most people think it is. > Also I'd probably get pissed for using vim over ssh session to program when sometimes the network could sporadically slows down my cursor movement. Also think of using screen or tmux or one of their alternatives in case your session breaks. It's bad enough being slowed down by a flaky connection, losing the session is very disruptive even if they produce backup files. There's also Emacs which comes with a server, I would expect it to survive connection losses but don't quote me on that. [1] http://rachelbythebay.com/w/2018/12/21/env/ http://rachelbythebay.com/w/2018/12/21/env/
- barefeg 5y agoHas anyone tried something like codespaces? I use vscode with either ssh, container dev, or both. But I feel it’s sometimes a bit slow. I’m wondering if a managed service could provide a better ux
- olekenneth 5y agoUse Emacs. You have something called tramp. Which can connect with sftp/scp/more to remote server.
- DaOne256 5y agoI wish that VS Code had a TUI (Text User Interface) with mouse support like mc to run it in a SSH console. Vim, emacs or nano are no alternatives for me as I need to browse large C/C++ legacy codebases and some newer JS. And I rely much on CTRL+mouseclick. Does anyone know a VS Code extension to use it in a shell instead of the desktop GUI?
- emacs28 5y agoJust out of curiosity, what does ctrl+mouseclick do in VSCode? I can almost guarantee there's a way to do it in Emacs :) If it has to do with looking up references, there's lsp-mode in emacs which gives it IDE capabilities for many languages.
- DaOne256 5y agoIt's "go to definition", I think CTRL-mouseclick is a common setting in most modern IDEs. In Eclipse it's F3 if I remember. VS Code was the only editor or IDE I found for Linux that can be used to browse like that without much configuration. CodeLite worked sometimes but not reliably. I can just type "code ." in my src folder and can start browsing it. Most IDEs need to setup some kind of indexing. VS Code worked out of the box.
- qbasic_forever 5y agoTry out the micro code editor, it has more generic/windows-like key conventions (i.e. Ctrl-C/Ctrl-V copy and paste), full mouse support, etc: https://micro-editor.github.io/ https://micro-editor.github.io/ It doesn't support everything VS code can do (notably it doesn't have LSP support), but it could be more accessible to you than vim or emacs.
- DaOne256 4y agoThx, I will definitely try it out when I'm back at my work PC.
- cudgy 5y agogit clone
- ris 5y agoThis is (partly) why I started using KDE's Kate as my editor. File access is all through a virtual io layer, which supports sftp amongst many others. And I've never switched away from it - long after that project - because it's "good enough".
- karmakaze 5y agoJetBrains IDEs (some/all?) have a menu option Tools->Deployment->Configuration where you can specify remotes via ssh and sync via rsync. I only use one-way sync from local to remote though 2-way is also supported. I simply git fetch/checkout on remote first, then git fetch/checkout the same branch on local. You can set up a local script to do both together. Once in that state, any locally changed files get sent to remote faster than I can switch focus to the terminal and enter a command/enter. There's also a Remote Development (beta) feature that essentially runs the JetBrains IDE headless on the remote and a local 'display server'. Performance largely depends on the performance of remote and network bandwidth much more than the Deployment Configuration rsync method.
- rramadass 5y ago((GNU Screen+dvtm) or tmux) + vim + ssh
- beagle3 5y agoA coworker of mine works locally in $editor_of_choice (which is VS for C#, VSC for most others, some weird DB system for SQL), and has a window of Beyond Compare always on top; that allows him to see what files are different locally/remote and push them (he compiles/tests remotely). Might work for you too. Another useful option, depends on your specifics, is the Plan 9 "cpu" command[0], available for Linux at [1]. It takes an unusual approach, which is IMHO superior for embedded machines, but which may work well for some other use cases (though not all). [0] https://fosdem.org/2022/schedule/event/plan_9_cpu_cmd/ https://fosdem.org/2022/schedule/event/plan_9_cpu_cmd/ [1] https://pkg.go.dev/github.com/u-root/cpu/cmds/cpu https://pkg.go.dev/github.com/u-root/cpu/cmds/cpu
- jesterson 5y agoUsing Coda 2 for many years already. Tried many other apps, but nothing comes close in terms of convenience and speed. Tried their new editor Nova and was utterly disappointed. The whole thing is practically unusable. Or I am too old :)
- atoav 5y agoFor my www-data directories mounting them via sshfs on boot turned out to be a good solution. For one-off stuff, raspbery pis, etc I tend to use sublime text and remoteSubl
- leros 5y agoIf you have fast internet, I like X forwarding. I used to run IntelliJ on my work computer in the office and render the window on my home computer. Everything is running on my beefy work computer and is local in the office. If you can SSH you can add a few parameters to the SSH command to do X forwarding.