Setting up a Git server (linux) and Git client (Windows 7)

On server (linux as gitserver):

On client (Windows 7):

Download windows installer from https://git-scm.com/download/win

Use these settings:

  • check Additional Icons and on the desktop, Use true type font
  • Start Menu Folder: Git
  • Use Git from Git Bash only
  • Use OpenSSH
  • Checkout Windows-style
  • Use MiniTTY
  • Enable file system caching and enable git credential Manager

Start Git Bash

cd ~/Documents
md GitServer
sudo apt-get install git-core
sudo useradd git
passwd git
ssh-keygen -t rsa

login in as git on linux server

mkdir .ssh && chmod 700 .ssh
touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys

copy/paste key generated key into authorized_keys

md project-1.git cd project-1.git git init --bare
mkdir project-1
cd project-1
git init
git config --global user.name "YOUR NAME"
git config --global user.email "YOUR EMAIL ADDRESS"

 

<<Add Some files>>

 

git add *
git commit -m "test" -a
git remote add origin ssh://git@gitserver/home/git/project-1.git
git push origin master

check using a different directory

md projects
cd projects
git clone ssh://git@gitserver/home/git/project-1.git
notepad "file" <- edit the file
git add *
git status
git commit -m "TEST2" -a
git push

Documentation on git:  https://git-scm.com/doc

Viewing the Commit History: git log

Viewing differences in last push (all files):  git diff HEAD HEAD^

Viewing differences from 2 pushes ago: git diff HEAD HEAD^2

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s