Shortest git client server setup

Simple git client server setup

Stuff you aren’t going to read;

  • simple git setup server client bash
  • the server is connected to the internet, like your hosting server
  • probably a linux server on the net, like Hostgator or Bluehost or Dreamhost
  • ssh access to that server
  • check for git on Mac or Ubuntu – git –version
  • Winders needs bash git from google
  • Click Here for a better beginner’s guide to git, or are using github
  • Stay here if you have hosting and want to create a private repository

Four steps, (one host & 3 client)

One step is performed on the host machine of the git repository, and three steps are performed on any client on any satellite client machine for that git repository;

  1. First, create an unmanaged repository on the server, which is on the internet addressable by url and with ssh access.
  2. Now, we have a directory initialized with no code yet, and git struggles with empty projects. So clone it and add some programs.
  3. Also on the client machine, now we edit some files,  the method you use to edit files in your directory (“gitproj”) varies.
  4. Update the repository. In this case initializing the original project version. first files on your client to start a master origin branch, and your git will work anywhere!

1. (HOST)

mkdir gitproj
cd gitproj
git --bare init

2. (CLIENT)

git clone ssh://user@host.com/~/gitproj
cd gitproj

3. (CLIENT) Optional

cat >hello.py
print 'hello world'
^D

4. (CLIENT) Update repository on server.

git add hello.py
git commit -m 'hello git'
git push origin master

Voila  – (The End)

We want to do more than this, but at first lets do some simple git client operations.

  • Example 1. Clone on another client and update.
  • Example 2. Edit files and update server repository

1. On a different client, or on the same client after renaming “gitproj” and creating a new, empty directory named “gitproj”

git clone ssh://user@host.com/~/gitproj
cd gitproj
vi hello.py
git commit -m 'changes to hello world'
git push

This is not a group approach, but if you develop a little on your work desktop, a little on your home desktop, and once in a while on your netbook, like I do, this is a big help for script development.