Emacs: magit status failed on ssh remote server repo - emacs

I'm using ssh to connect to a remote server. On the server there is a git repo called MRFLSSVM. However, when I execute magit-status on:
/ssh:qmServer:/home/Chang/qmCodeLab/MRFLSSVM/
Magit asks me to Create repository in /ssh:qmServer:/home/Chang/qmCodeLab/MRFLSSVM/?.
Any idea how to let magit recognize that repo? (I've already installed git 2.10.0 on /usr/local/git and configured my system (CentOS) to use it by update-alternatives)
-----------Edit------------------------------
Error (magit): Magit requires Git >= 1.9.4, you are using 1.8.3.
If this comes as a surprise to you, because you do actually have
a newer version installed, then that probably means that the
older version happens to appear earlier on the `$PATH'. If you
always start Emacs from a shell, then that can be fixed in the
shell's init file. If you start Emacs by clicking on an icon,
or using some sort of application launcher, then you probably
have to adjust the environment as seen by graphical interface.
For X11 something like ~/.xinitrc should work.
If you use Tramp to work inside remote Git repositories, then you
have to make sure a suitable Git is used on the remote machines
too.
Error (magit): Magit requires Git >= 1.9.4, but on /ssh:qmServer: the version is 1.8.3.
If multiple Git versions are installed on the host then the
problem might be that TRAMP uses the wrong executable.
First check the value of `magit-git-executable'. Its value is
used when running git locally as well as when running it on a
remote host. The default value is "git", except on Windows
where an absolute path is used for performance reasons.
If the value already is just "git" but TRAMP never-the-less
doesn't use the correct executable, then consult the info node
`(tramp)Remote programs'.
This problem seems to be tramp is not using the correct git on remote server. I've tried to change magit-git-executable to usr/local/git/bin/git which is the path both of my local and remotes installed git. But this still doesn't work.
Any ideas to solve this? Thanks!

Related

Using host system Git when using WSL Remote in VSCode

I am currently trying to set up a new development environment, using VSCode, WSL, and the WSL Remote Extension. The environment will also utilize Git, and will sign commits via a YubiKey.
I initially tested this out the setup on a Windows 10 machine, using wsl2-ssh-pageant, and that worked flawlessly. I could sign commits straight from my WSL environment, and everything was awesome. Then I tried implementing this on my work machine, which is running Windows 11... Nothing is awesome.
Apparently there are a whole bunch of issues getting something like this to work on Windows 11, and the author of that library has abandoned the project. I have tried finding an alternative, testing things like npiperelay, wsl-ssh-agent, and a ton of others (too many to list), but the issue always comes back to Windows 11 (and downgrading is not an option).
Therefore, I decided to try a different approach. I can sign commits from Windows 11, using the Yubikey, without issue. So I wanted to get VSCode to use my local Windows 11 Git installation, rather than the WSL one. However, even when configuring git path in the settings, to use the Windows 11 Git, it seems to be using it inside a WSL container, meaning the Yubikey is unreachable; so all signing fails.
I should probably mention that both WSL and Windows 11 has access to the folder.
My current workaround is to do my development in VSCode, and then do all Git commands in a Windows 11 Terminal, which allows me to do signing, but it skips all the VSCode GUI and fancy tools, so I would like to keep everything in a single place.
So my question is: Is there a way to develop in WSL via VSCode, using the remote extension, while making VSCode do all Git operations on the host system (completely ignoring WSL)?

Eclipse does not find git on windows installation

I'm using eclipse in windows for embedding programming. Naturally git is a big part of my work and I want to keep track of hashes in my code. I tried using this question, and many similar ones to have the git hash as a preprocessor micro. So added git log -1 --pretty=format:'#define GIT_HASH %h' > ../Inc/gitinfo.h to pre-build step.
The trouble is that eclipse does not find git even though it is in the path (git works in windows cmd), and egit is also installed on my eclipse (Neon 4.6.3).
Also tried to add the command in a batch file and run that file in the pre-build using cmd /c "../../mybatchfile.bat" which throws '..' is not recognized as an internal or external command,.
I would appreciate any guidance on that.

GitHub for website development

OK< I know I can use Eclipse for Java programming and such but I work using WAMP for editing PHP, XHTML, JavaScript files... what IDE is best to edit the files and use GitHub? Because I don't know want to go to localhost and then copy my files to my local GitHub repo...
Cloud9 IDE might be what you are looking for! It's an online IDE with out-of-the-box intergration with GitHub, heroku etc. and gives you the ability to share workspaces as well.
Eclipse has the egit plugin that is really nice. You can use aptana which is based around eclipse but includes all the web views. It can basically edit everything you mentioned and really well, while providing a nice wrapper for your git repos
http://aptana.org/products/studio3
http://eclipse.org/egit/
well is not an IDE but vim with some git plugins is the best for me.
Eclipse should have some git plugins also, I think.
The best way to learn git is yo use it from command line!
Emacs + tramp + the command line ?
Update: magit is reported to support tramp
Update:
My experience: I have a distant linux server running a rails app. and private git repositories / apache (using several VirtualHosts with or without ssl). That server runs a ssh server. I use bare ssh session for command line usage (git, nominal admin.) and emacs + tramp to remotely edit the files presents on that server. I you are not rebuked by anti-eye candies tools (as for not-at-all drag'n'drop stuff), I would suggest you to give emacs a try (see EmacsW32 and nXhtml if you are under Windows). I assume you can install a ssh server on your WAMP machineā€¦ If this is the case, you could open your file from emacs just by using the following syntax (assuming you would edit the /home/renaud/.bashrc on the distant server):
/ssh:user#obf.uscatedmachine.org:/home/user/.bashrc
With putty on windows: see that and this posts.
It works the same for directories. You shall be prompted for your password once, and then edit the file/directory as if it is just on your machine. For the git part, I have verified myself since I do the git stuff directly from a ssh terminal, but latest magit
is reported to support tramp (i.e. remote git plumbering from my understanding).
If you have never used emacs before, it will not be easy. You will have to learn emacs basics first and customize it to fit you needs. My opinion is that's worth to give it a try. I could help you with basic configuration if needed.
(I use myself emacs almost for everything on my linux box from simple text editing to Java programming.)
Update:
After some testing, magit works very well remotely (tested on linux)! A new mode added to my configuration thanks to your question!

Using a single emacs instance from multiple (virtual) machines

I love emacsclient. It allows me to use a single Emacs frame for all my editing, also when programs want to open an editor (i.e. export EDITOR=emacsclient).
I'd like to have it work like this with virtual machines, too. I can use tramp to edit remote files with Emacs in my single-frame setup, and it works very well, but it's not enough. When I invoke git commit or sudoedit, I'll have to use the crappy terminal-based editor that happens to be installed on the remote machine.
So, is there anything like emacsclient that works across multiple machines?
Speculation: If you can ssh from the VM back to your local machine then the VM could probably invoke emacsclient on your local machine, with the appropriate tramp prefix to the remote file? Set up a script for that, and configure your remote EDITOR environment variable to match.
It could be you can do more with TRAMP than you think. First off, you may have noticed that /sudo: doesn't work for remote boxes, but TRAMP allows you to proxy to a remote box and then use any supported protocol, so in effect you can use /sudo: on a remote box. See tramp-default-proxies-alist.
You mentioned invoking git commit on a remote box. Have you considered using one of the Emacs git interfaces such as magit? They will work through TRAMP as well.

Eclipse: How to clone git over ssh with keyfile?

Hey, I am using Eclipse (while running Ubuntu 10.10) and would like to connect to a remote git. Normally I would use the egit plugin, but now I need to connect over ssh with keyfile.
Unfortunately egit has no "with keyfile" option, is there a way to connect to my repository with my keyfile?
Is there a "hidden" way to make Eclipse to pass parameters (-i keyfile) to ssh or something?
http://wiki.eclipse.org/EGit/User_Guide/Remote - I had to manually load my existing key in the "Key Management" tab.
I don't know anything about egit. But what you usually do is:
Start ssh-agent (mine is automatically started, when my window manager starts, so you have to google a bit how to setup it)
Run ssh-add [your key]
Use git over ssh as usual. It won't ask you for any passwords, since ssh-agent takes care of it.
HTH