Skip to content

Latest commit

 

History

History
216 lines (183 loc) · 6.65 KB

git.md

File metadata and controls

216 lines (183 loc) · 6.65 KB

git

vscode clone

step by step guide to clone a CSC repository using vscode using SSH as transport layer.

step comment
prereq
place ssh keys, private and public into your user home folder
.ssh is required
prereq
verify user name and email
test connection ssh -T [email protected]
a personal greeting should come back
prereq
navigate online to you repository
copy clone with SSH string
prereq
start vscode
open command palette
prereq
pick Git Clone command
prereq
paste clone with SSH string in
press Enter
prereq
pick a folder to clone your repo in
prereq
cloning in progress
prereq
cloning done, wanna open repo now?
prereq
note status bar color change
always be aware of active branch , bottom left , here master
prereq
click on master to change branch
prefix origin/ point to remote repo branch

vscode branch

step comment
git-bash branch
look line above current input right inside parentheses
vscode branch
look bottom left to identify active branch
vscode branch
verify merge request before commit
vscode branch
1 active branch
2 change branch
vscode branch
git=bash branch
vscode branch
1 navigate to changes
2 stage changes
vscode branch
1 navigate to SCM via menu
vscode branch
1 stage changes
2 staged changes
3 provide commit message, shows up in repo
vscode branch
1 finalize staging by pressing <Ctrl>+<Enter>
2 push staged changes into remote repo
💡 can happen at a later time
vscode branch
using ssh as transport layer, key phrase is required
vscode branch
working for a time
vscode branch
check remote repo
vscode branch
see your commit is visible in remote repo

vscode check out

step comment
CMT
open command palette by pressing <Ctrl>+<Shift>+P
1 enter git
2 select Git checkout to ..
CMT
select branch
CMT
see even git shell has changed upstream branch 👍

git lfs

storing large binary files in your repository will slow down performance considerable. use git lfs extension to circumvent this problem. it is very simple and transparent to use.

navigate to git lfs download and install, mirgrate

on linux it's even more simple

sudo dnf install git-lfs

inside your repo, you need to add extension, which are to be tracked by lfs.

git lfs install
git lfs track "*.png"
git lfs track "*.jpg"
git lfs track "*.jpeg"
git lfs track "*.tiff"
git lfs track "*.pdf"
git lfs track "*.7z"
git lfs track "*.tar"
git lfs track "*.gz"
git lfs track "*.xls"
git lfs track "*.xlsm"
git lfs track "*.xlsx"
git lfs track "*.doc"
git lfs track "*.docx"
git lfs track "*.vsd"
git lfs track "*.vsdx"
git lfs track "*.vss"
git lfs track "*.vssx"
git lfs track "*.ppt"
git lfs track "*.pptx"
git lfs track "*.ipynb"
git lfs track "largefiles/*.xml"
git lfs track "largefiles/*.csv"

in case you cloned repository before having git lfs installed, files tracked by lfs will not be present in your repo, only a link will be there. just enter 2 commands to fix it.

git lfs fetch
git lfs checkout

vscode branch

step comment
CMT
open command palette by pressing <Ctrl>+<Shift>+P
1 enter git
2 select Git checkout to ..
CMT
select branch
CMT
see even git shell has changed upstream branch 👍

config

get configuration data

step comment
version git --version
get user name git config --global user.name
get email git config --global user.email

set configuration data

step comment
user name git config --global user.name "<your name>"
email git config --global user.email "<your email>"

ssh

step comment
chk fn type %userprofile%\.ssh\id_rsa.pub
gen ssh-keygen -t rsa -C "<your email>" -b 4096
test ssh -T [email protected]

enter password phrase just once at git-bash launch, edit line ⬇️ to ~/.bashrc

SSH_ENV=$HOME/.ssh/environment

# start the ssh-agent
function start_agent {
    echo "Initializing new SSH agent..."
    # spawn ssh-agent
    /usr/bin/ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV}
    echo succeeded
    chmod 600 ${SSH_ENV}
    . ${SSH_ENV} > /dev/null
    /usr/bin/ssh-add
}

if [ -f "${SSH_ENV}" ]; then
     . ${SSH_ENV} > /dev/null
     ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
        start_agent;
    }
else
    start_agent;
fi