Some simple instructions to get you started
First establish SSH connection your own local system with the target system using private keys instead of password. It will make SSH a lot simpler and also make it possible to for GIT tool to SSH to the remote server without keep on needing to type in the credentials.
Refer to
https://www.digitalocean.com/commun...sh-key-based-authentication-on-a-linux-server for instructions on how to do it.
So now I have the remote server in my example is
ubuntu@dksg_colony, below is how I setup my git repository in the remote server
Code:
ubuntu@dksgcolony:~$ mkdir WORK
ubuntu@dksgcolony:~$ cd WORK
ubuntu@dksgcolony:~/WORK$ mkdir special_project
ubuntu@dksgcolony:~/WORK$ cd special_project/
ubuntu@dksgcolony:~/WORK/special_project$ git init --bare
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: git branch -m <name>
Initialized empty Git repository in /home/ubuntu/WORK/special_project/
ubuntu@dksgcolony:~/WORK/special_project$ ls -al
total 40
drwxrwxr-x 7 ubuntu ubuntu 4096 May 13 18:38 .
drwxrwxr-x 3 ubuntu ubuntu 4096 May 13 18:38 ..
-rw-rw-r-- 1 ubuntu ubuntu 23 May 13 18:38 HEAD
drwxrwxr-x 2 ubuntu ubuntu 4096 May 13 18:38 branches
-rw-rw-r-- 1 ubuntu ubuntu 66 May 13 18:38 config
-rw-rw-r-- 1 ubuntu ubuntu 73 May 13 18:38 description
drwxrwxr-x 2 ubuntu ubuntu 4096 May 13 18:38 hooks
drwxrwxr-x 2 ubuntu ubuntu 4096 May 13 18:38 info
drwxrwxr-x 4 ubuntu ubuntu 4096 May 13 18:38 objects
drwxrwxr-x 4 ubuntu ubuntu 4096 May 13 18:38 refs
ubuntu@dksgcolony:~/WORK/special_project$
Now on my local system (I'm using Mac OS X)
Code:
Enterprise:WORK davidktw$ git clone ssh://dksg_colony/~/WORK/special_project
Cloning into 'special_project'...
warning: You appear to have cloned an empty repository.
Enterprise:WORK davidktw$ cd special_project/
Enterprise:special_project davidktw$ ls -al
total 0
drwxr-xr-x 3 davidktw staff 96 May 13 18:39 .
drwxr-xr-x 148 davidktw staff 4736 May 13 18:39 ..
drwxr-xr-x 9 davidktw staff 288 May 13 18:39 .git
Enterprise:special_project davidktw$ echo abc > abc
Enterprise:special_project davidktw$ git add .
Enterprise:special_project davidktw$ git commit -m 'Initial Commit'
[master (root-commit) c475dc6] Initial Commit
1 file changed, 1 insertion(+)
create mode 100644 abc
Enterprise:special_project davidktw$ git push
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 216 bytes | 216.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
To ssh://dksg_colony/~/WORK/special_project
* [new branch] master -> master
Enterprise:special_project davidktw$
On the same local system in a different direction, I clone out the project again
Code:
Enterprise:WORK2 davidktw$ git clone ssh://dksg_colony/~/WORK/special_project
Cloning into 'special_project'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (3/3), done.
Enterprise:WORK2 davidktw$ ls
special_project
Enterprise:WORK2 davidktw$ cd special_project/
Enterprise:special_project davidktw$ ls -al
total 8
drwxr-xr-x 4 davidktw staff 128 May 13 18:41 .
drwxr-xr-x 3 davidktw staff 96 May 13 18:41 ..
drwxr-xr-x 12 davidktw staff 384 May 13 18:41 .git
-rw-r--r-- 1 davidktw staff 4 May 13 18:41 abc
Enterprise:special_project davidktw$
That's all you need, nothing so difficult and special. Linux, GIT, SSH
Other than GIT, which you can easily install using from the distro repo using APT/YUM/PACMAN or whatsoever, probably install OPENSSH if for whatever reason your linux box doesn't have it installed (mostly unlikely), the instructions to get started is straight forward and easy.
Sometimes technology is this easy, but a lot of people tend to complicate things with all the bells and whistles which are good to have, but not essential. Get the basics working and learn the decorations as and when you need.
Like to backup your remote recon periodically ? Simple, setup the cronjob to run
Code:
tar -czf special_project-`date +'%s'`.tar.gz ~/WORK/special_project
as often as you like
Easy ?