Git Set Up

I am writing this tool since I do not want to surf the internet and look for the steps to build git repo.

This problem I want to solve is: I want to build git repo in one server and clone it if I want to have it on another server.

On server A:

1
2
3
4
5
6
7
8
9
10
git config --global user.name "Steven Sun"
git config --global user.email "stsun@gmail.com"
git config --global --list
git config --global color.ui "auto"

mkdir mysite
cd mysite
git init
git add .
git commit -am "first comit"

For the address of your repo, refer to the following:

1
2
3
4
5
6
7
$ git clone http[s]://example.com/path/to/repo.git/
$ git clone ssh://example.com/path/to/repo.git/
$ git clone git://example.com/path/to/repo.git/
$ git clone /opt/git/project.git
$ git clone file:///opt/git/project.git
$ git clone ftp[s]://example.com/path/to/repo.git/
$ git clone rsync://example.com/path/to/repo.git/

Thus in my working environment, I can issue the followin command to clone the repo in a server to another:

1
git clone ssh://example.com/path/to/repo.git/

We can use “git pull” to pull the latest files.

For the .gitignore file, we can create one in the repo dir and add to the .gitignore file something like this:

1
2
3
4
*.jpg
*.jpeg
*.png
*.old

For the details, please refer to online resources.