You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
3.1 KiB
3.1 KiB
scm-setup
Source Control Server Preparation
Pre-requisite
- ssh client (built-in on Windows 10. Preinstall with Git installation). For windows 7 alternative, try Putty
# use windows package manager
$ winget install PuTTY.PuTTY
# use windows package manager
$ winget install Git.Git
# use windows package manager
$ winget install TortoiseGit.TortoiseGit
# use windows package manager
$ winget install tailscale.tailscale
Configuration
- setup sshkey. Run below to generate the private / public key.
$ ssh-keygen
- Pass the
c:\users\<username>\.ssh\id_rsa.pubto administrator to authorise the access to server (xxx.xxx.xxx.xxx)
# from ubuntu shell
$ ssh-copy-id -i ~/.ssh/id_rsa.pub mitpenang@xxx.xxx.xxx.xxx/home/mitpenang/.ssh/authorized_keys
# from powershell
PS c:> type $env:USERPROFILE\.ssh\id_rsa.pub | ssh mitpenang@xxx.xxx.xxx.xxx "cat >> .ssh/authorized_keys"
- Setup Tailscale. Need remote access to administrator to do first login. Please install AnyDesk to facilitate remote access
- Setup
c:\Windows\System32\Drivers\etc\hostsfile. Install PowerToys. Add the following entry to host file
127.0.0.1 dev.mitech.com.sg # Test Eng Server
- Setup git profile configuration
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
# setup default branch name as `main`
$ git config --global init.defaultBranch main
# Checking the settings
$ git config --list
Accessing the server
- Establish ssh port forwarding. Open a command prompt. Run below command. The ssh IP address can be found from Tailscale console
$ ssh -L 3000:172.16.16.2:3000 -L 29419:172.16.16.2:29419 mitpenang@100.72.57.125
- Open Chrome. Browse to Source Control Server Mitech : Gitea
- Setup Gitea repo SSH access. [Reference from Github]](https://jdblischak.github.io/2014-09-18-chicago/novice/git/05-sshkeys.html)
- To clone, use
git ssh://... - Alternatively, use below command to keep the ssh port forwarding active in background
# -N : not to execute remote command
# -f : run in the background
$ ssh -N -f -L 3000:172.16.16.2:3000 -L 29419:172.16.16.2:29419 mitpenang@100.72.57.125
Git
