Solution for Git GUI client for remote SSH
If your server has it enabled, you can use XForwarding
to display a GUI executed on the remote machine on your local machine.
On the server-side, this means that you need to have the proper tools installed (e.g., git-gui
, which means that you also need Tcl/Tk installed, which means that you also need the X
infrastructure installed).
You also must enable Xforwarding, by making sure that you have a line like the following in your /etc/ssh/sshd_config
:
X11Forwarding yes
To use that on your local Linux machine, you would usually use the -X
flag to enable XForwarding
for a given connection:
shiro@local:~$ ssh -X gituser@gitserver
gituser@gitserver:~$ cd repo.git
gituser@gitserver:~/repo.git$ git gui
On your local OS X machine, you would instead use -Y
:
shiro@applejoice:~$ ssh -Y gituser@gitserver
gituser@gitserver:~$ cd repo.git
gituser@gitserver:~/repo.git$ git gui
You need an Xserver
running on your local machine, in order to use XForwarding
. While this is not a problem on Linux (or OS X), it gets complicated for Win32. There are tutorials on the web for setting up and using Xservers under Win32 (e.g., Xming
).
Git GUI when on a remote server
Install xming (x server) and run git guy over ssh with X11forwarding?
Can't find a decent git gui for windows. Anyone know of one?
GitHub for Windows came out recently. It manages local repos as well as supports pushing to github.com. I have been playing with it and must say it is fantastic.
Git remote as local
There's almost no distinction between "client" and "server" Git installations: Git provides exactly one program which is able to serve Git repositories by itself — git-daemon
. And as it provides no authentication, it's usually only installed on machines which serve publicly-accessible repositories (using the free-for-all read-only git://
protocol).
All the "usual" write access to Git repositories is mediated by other software — typically a HTTP[S]
server (for http://
protocol) or SSH
server (for ssh://
protocol). This software performs the necessary authentication and authorization and then calls a low-level Git program to carry out the client/server data exchange.
So you should decide how you want to access your repositories first.
In your circumstances I would opt for SSH: as your web host is (supposedly) a Linux-powered VPS, it most probably has SSH server already up and running, and you should have been given an account for this (if not, there's the time to ask).
The rest of the story is explained here (with nice pictures). The only difference for you is that since you won't be using github, you will have to manually transfer your public SSH key to your VPS host.
More info on hosting Git on the server as usually is available in The Book (with this being a later-time addendum regarding the improved HTTP[S]
support in Git).
Update on using SSH with Git.
In fact, hosting a Git repository accessed over SSH might be both dead simple or complicated depending on what you're setting up — a simple solution or a high-profile server with virtualized Git users and access rights management etc.
Using SSH, Git works this way:
- The client performs SSH connection with the SSH server process running on the machine hosting the target Git repo. Usually this is done using the so-called pubkey authentication.
- After the connection is established, the client tells the other side to spawn a special Git process which then talks to the local Git process, and SSH carries out their exchange — authenticated and encrypted.
There are two other bits which are essential to master to let us move further:
While SSH supports several "services" (for instance, SFTP — a secure version of FTP, and making plain TCP tunnels), the most common use case for it is starting a process remotely, and in the most common case it's a shell (that's why it's named SSH after all — a Secure SHell).
When such a remote process is started it works with the credentials of the logged in user. So when you log into an SSH server — either "by hand" or Git does this for you — a shell is started on the remote server, and it works with the credentials of the remote user which you authenticated as.
Before trying to access a remote repository the Git client parses the URL of that repository. The gory details are in the
git-fetch
manual but the simple thing is that an URL likessh://user@server/path/to/the/repo.git
is broken down to the protocol part, the user, the server and the path to the repository, which is
/path/to/the/repo.git
This path to the repo is a physical path on the server. So yes, it's that simple: you do not have to tweak some sort of config file or so to tell Git where the repo is, instead, you just speficy it in your URL.
A somewhat advanced twist of the repository path handling is that it's possible to use a special shortcut to refer to the home directory of the remote user. This is done using the path like
/~/devel/repo.git
Which makes Git to look for the directory named "devel" under the home directory of the remote user and then look for the "repo.git" directory in there. This approach is useful if you do not want to set aside a special directory to keep Git repositories. Also this approach is ideal for one-man projects.
On a typical Linux-based OS, users have their home directories under the
/home
hierarchy, so that a userjohndoe
has/home/johndoe
as their home directory. After logging in interactively via SSH you can verify what's your home directory is by doingcd
pwd(the first command changes the current directory to the home directory and the second one prints the current directory).
So, for the simplest case you could do just this:
Log into the server via SSH.
Create a server-side repository somewhere:
cd /var/tmp
mkdir test.git
cd test.git
git init --bareLog out.
Add this remote to your local repository:
git remote add test ssh://user@server/var/tmp/test.git
Work with this remote:
git push test master
To verify Git works OK on the server, just try something like
ssh user@server "git --version"
or
plink user@server "git --version"
if you're using PuTTY and not the OpenSSH client shipped with Git for Windows.
Related Topics
Sort Logs by Date Field in Bash
Increase of Virtual Memory Without Increse of Vmsize
How to Forward Localhost Port on My Container to Localhost on My Host
Docker Alpine Executable Binary Not Found Even If in Path
Apache Server Keeps Crashing, "Caught Sigterm, Shutting Down"
Sed: -I May Not Be Used with Stdin on MAC Os X
Renaming a Set of Files to 001, 002,
Unix 'Alias' Fails with 'Awk' Command
How to Check Fips 140-2 Support in Openssl
How to Specify Non-Capturing Groups in Sed
How to Create Opengl Context via Drm (Linux)
Get Link Speed Programmatically
How Is the Address of the Text Section of a Pie Executable Determined in Linux
Possible Values for 'Uname -M'
Linux Keyboard Event Capturing /Dev/Inputx