Hot answers tagged

20

When you are saying "I am using tramp via ssh" I suppose you open a file like /ssh:host:/path/to/file. This is supposed to use always the ssh method. If you want to use the scp method, you shall use /scp:host:/path/to/file. This uses automatically ssh for short files, and scp for large files. If you trust the default method set in tramp-default-method, you ...


16

Well this turned out to be more of a rabbit hole than I though... And for what I can gather there's not a better solution for this specific issue, with this combination of desktop, ssh-agent, emacs. Problem 1 XFCE was starting it's own ssh-agent with the session, without actually saying so anywhere, which caused the system to have 1 unused global ssh-agent, ...


13

Another solution for the lazy is to just use a package that handles exactly this case (setting Emacs' keychain-related environment variables): Install and add to your init.el package keychain-environment. Run M-x keychain-refresh-environment and now it should work. Place (keychain-refresh-environment) in your init.el, so the solution works after restarting ...


12

There are a few answers here. Quitting Emacs without C-x C-c First, you can quit emacs by running the command that C-x C-c is bound to: M-x save-buffers-kill-terminal. Alternatives to recursive Emacs Emacs is able to edit files on remote servers, so you don't even need to ssh into the remote server, and you won't need an Emacs inside a term inside your ...


11

auto-revert-tail-mode is great, but it has its limits. Therefore I prefer to use an asynchronous shell command. Open the remote directory in dired, position the cursor to the file you want to watch, and apply ! tail -f * &. If you want to suppress Tramp messages, decrease the verbosity. (setq tramp-verbose 1) shall be sufficient.


11

Using TRAMP multi-hops. For instance, if you want to edit the remote file /root/salary.txt /ssh:homer@powerplant|sudo:powerplant:/root/salary.txt The example is taken from the Mastering Emacs book.


10

I had a similar problem when trying to open/save plain ASCII files via tramp's sftp: the files were fine, I was able to edit them with, for example,nano, but trying to open them via tramp would get rejected with the rather cryptic message: invalid string format. This was probably related to inlining and compression, because changing those solved the issue ...


9

Since TRAMP uses ssh by default, the real question you are asking is if you should use local or remote emacs to edit remote files. Right? Is it considered better to use ... There is no better, just that use cases differ for both local and remote editing. What are some of the considerations involved in making this decision? If you normally work with ...


9

Running ssh-agent and hoping for the best is not enough. ssh-agent hands out the decrypted private key to everyone asking on a specific socket. The problem is that the socket is not always the same and therefore only those processes that know the currently used socket can benefit. When ssh-agent is started it outputs the socket and its pid. $ ssh-agent ...


8

Quick answer That's not an issue, it's a statement of fact. M-x shell isn't a fully functional terminal - it simply can't do what you want it to do. If you want a full terminal emulator in emacs, you have to use M-x ansi-term instead. Explanation This isn't an Emacs issue per se, but a consequence of how different kinds of terminals process input, and ...


7

As pointed out by @Nsukami and briefly summarized in my comment he linked to, this is not supported out-of-the-box yet. But by following these suggestions you should be able to get it to work. What I don't understand is, if this doesn't work with when ssh'ing into a remote host, when would setting $EDITOR [to anything but emacsclient] by handy? Using ssh ...


7

I would do this outside of Emacs, with a wrapper script that pulls the updated config first. Something like this: #! /bin/sh cd ~/.emacs.d && git pull --rebase exec /usr/bin/emacs "$@" Then make this executable, name it emacs, and put it on your PATH before the real one. Another option would be to have init.el do pretty much the same thing: (call-...


7

You'll have to customize the tramp-password-prompt-regexp variable with the second prompt to finish the 2-factor authentication. The remote shell setup part of the manual has a simple example. This is not a new feature but an old feature that you adapt to the second prompt of the 2-factor authentication. This same facility was used in days of yore for ...


7

I know it's an old question and that you maybe don't care about the answer now but I do faced the same issue. I was pretty sure it was OS X related but in fact lags and timeouts were caused by my remote prompt! Tramp is limited in its remote prompt parsing and relies on it to know if a command has finished or not. I googled for days always including "os x"...


6

I agree with Emacs User: Neither approach is objectively "better". If you don't have any obvious compelling reason to go with one or the other, then it's really just a subjective balance between performance and convenience. If you need only occasional access to any given server, the ease of using TRAMP ought to trump a low-to-moderate performance hit. If ...


6

Magit's wiki now features a page about the various ways one can push from Magit when using MS Windows. Also checkout the new ssh-agency package. Both the wiki page and the package were written by @npostavs. Also note that it is virtually never Magit's fault if you cannot push. It's usually a configuration issue (even if you can push from the shell but not ...


6

It sounds like you should extend tramp-methods, adding a new method which is similar to the sudo method but uses qsub -I instead. You would then be able to use a multi-hop tramp path to first connect to the head node and then to connect to a compute node. Try this: (add-to-list 'tramp-methods '("qsub" (tramp-login-program "qsub") (tramp-...


6

Usually, the problem is that Emacs can't access the password prompt of git on Windows. Thus, it seems to "hang" on push, where it really is waiting for your password. You can circumvent this by using an ssh key instead of a username/password in your git repo, and doing the first push manually in the shell (git will remember your ssh password after the first ...


6

Similar to Emacs bug#20015, this can be avoided by setting tramp-ssh-controlmaster-options before loading tramp. (setq tramp-ssh-controlmaster-options "-o ControlMaster=auto -o ControlPath='tramp.%%C' -o ControlPersist=no") (require 'tramp) Or with use-package: (use-package tramp :init (setq tramp-ssh-controlmaster-options "-o ...


6

Error (magit): Magit requires Git >= 1.9.4, you are using 1.8.3. I've already installed git 2.10.0 on /usr/local/git The list of directories to search for executables on remote hosts is controlled by the option tramp-remote-path. It does begin with a "what the remote told me what I should be using" element, but in my experience that doesn't ...


5

Have you tried the multi-hop method as suggested in the TRAMP manual? C-x C-f /ssh:user@localhost|sudo:localhost:/path/to/file RET


5

There is Tramp. You can edit a file on another machine using the syntax /ssh:user@machine:/path/to/file. If you take sudo instead of ssh, and empty user and machine, you can edit a local file as root. Like /sudo::/path/to/file.


4

This is common problem, seems to be a bug in Emacs. Potential solutions are; turn the number of CPUs down to 1 in virtual box. force display redraw in isearch (add-hook 'isearch-update-post-hook 'redraw-display) use this PPA (if you're on ubuntu) ppa:martin-trojer/emacs24-termfix Here's some references where this issue is also discussed; https://...


4

Try this Open a remote directory in dired using tramp. C-x d /ssh:username@hostname:/path return Start a remote shell. M-x shell


4

The pipe | is special to the shell, try quoting the whole filename.


4

After suggestions... (defun add-ssh-agent-to-tramp () (cl-pushnew '("-A") (cadr (assoc 'tramp-login-args ; if on Windows using Putty with Pageant, ; replace "ssh" with "plink" (assoc "ssh" tramp-methods))) :test #'equal)) (add-ssh-agent-to-tramp)


4

Edit ~/.ssh/config so that it contains the following: Host github.com IdentitiesOnly yes IdentityFile ~/.ssh/your_ssh_key Then whenever magit asks git to ask ssh to talk to github.com, ssh will know what key to use; saves a lot of mucking about.


4

If you don't care about whether Emacs is a "fully-functional" terminal or not and you just want it to work without making you press enter, then run the psql command \pset pager off. This will make psql skip running a pager program and just dump all the output at once. You can then scroll through the output using the Emacs scrollbar or scrolling ...


4

You can use the ssh-agency package for this. It integrates with magit, and will run ssh-add as needed when you push. If you don't have ssh-askpass installed, you will need a version which includes this fix (pushed Apr 4, 2018) to successfully prompt for a passphrase on a Unixish system. Note: I'm the author of this package.


4

Emacs 26 by default switches on double buffering for X servers when it finds the Xdbe header on the build machine. (See Emacs 26 release notes at the GitHub mirror.) Some X servers don’t support this. Therfore switching off double buffering by adding '(inhibit-double-buffering . t) to your frame parameters might fix this. Safest way is to add it to default-...


Only top voted, non community-wiki answers of a minimum length are eligible