Overview
This article provides a simplified guide for those who use XServer and manage their source code with GitHub.
XServer is a popular and reliable rental server service in Japan, offering high dependability and convenience. By utilizing GitHub for development or production environments on this server, you can streamline the deployment process, eliminating the need to manually upload files via FTP.
Please note that this article does not cover the basics of GitHub or Git commands. Additionally, XServer VPS is not considered here, though the steps outlined may still be applicable.
Steps to Set Up
SSH Configuration
The first step is to configure SSH access for XServer.For those unfamiliar with SSH:
Think of SSH as "remote control for a computer." That’s all you need to know for now.

To remotely operate the XServer rental server, you will need a file called an "SSH key."
First, follow the XServer SSH settings guide to generate an SSH key:
SSH Connection
Once the SSH key is generated, try accessing XServer using the following command.
mv <Path to the SSH key file> ~/.ssh
chmod 0700 ~/.ssh
chmod 0600 ~/.ssh/<SSH key file>
Once that is done, execute the following command to access XServer:
Refer to the SSH account information available in the XServer SSH settings guide for details on setting the server ID.
ssh -i .ssh/<SSH key file> <server ID>@<server ID.xsrv.jp> -p 10022
During the connection process, you will be prompted to enter the passphrase you set when generating the SSH key. Enter the passphrase to proceed.
If successful, the left side of the %
symbol in the command line will display information about the server you have accessed.

Downloading the Git Package
Next, check if the git
command can be executed on the target server using the following command:
git version
If the Git version is displayed, you can skip the steps below and proceed to Step 3.
If you see a message like "git: command not found," you will need to install the Git package by following the steps below:
Install the gettext
package, which is required for the Git package installation.
cd /tmp
wget https://ftp.gnu.org/pub/gnu/gettext/gettext-0.22.5.tar.gz
tar xvf gettext-0.22.5.tar.gz
cd gettext-0.22.5
./configure --prefix=$HOME/local
make
make install
echo "export PATH=$HOME/local/bin:$PATH" >> ~/.bashrc
source ~/.bashrc
cd ..
rm -rf gettext-0.22.5
Install the Git package.
cd /tmp
wget https://www.kernel.org/pub/software/scm/git/git-2.30.0.tar.gz
tar zxf git-2.30.0.tar.gz
cd git-2.30.0
./configure --prefix=$HOME/local
make all
make install
cd ..
rm -rf git-2.30.0
git --version
Finally, verify the installation by running the git --version
command. If the Git version is displayed, the installation is complete.
Git Connection Setup
Installing Git is just the beginning. Next, you need to configure the connection with GitHub.
Generate an SSH Key (Public/Private Key Files) using the following command.
When prompted for a passphrase, you can ignore it and simply press Enter repeatedly.
ssh-keygen -t rsa -b 4096
After running the command above, execute the following command to display your public key:
cat ~/.ssh/id_rsa.pub
Next, Open GitHub in your browser. Then, navigate to Your Avatar (top-right corner) > Settings > SSH and GPG Keys > New SSH Key.

→

→

When the New SSH Key page appears, Paste the copied key into the Key field.
Optionally, add a Title for the key. Then, ensure Key Type is set to Authentication Key (default).

Click the Add SSH Key button. Then, return to your SSH session on XServer and run the following command to test the connection:
ssh -T git@github.com
You've successfully authenticated, but GitHub does not provide shell access.
Once you see the message, the GitHub connection setup is complete!
From here, you can manage your XServer operations by cloning repositories with git clone
, deploying updates with git pull
, and more!
For those who find it tedious to upload source files manually through XServer's browser interface using FTP, it might be a good idea to try managing your workflow with GitHub and XServer.