{"id":8168,"date":"2019-08-31T15:05:48","date_gmt":"2019-08-31T15:05:48","guid":{"rendered":"https:\/\/alexrusin.com\/?p=8168"},"modified":"2019-10-11T14:50:54","modified_gmt":"2019-10-11T14:50:54","slug":"loading-start-scripts-for-gitbash-on-windows","status":"publish","type":"post","link":"https:\/\/blog.alexrusin.com\/loading-start-scripts-for-gitbash-on-windows\/","title":{"rendered":"Loading Start Scripts for GitBash on Windows"},"content":{"rendered":"\n
I use GitBash as my shell on Windows. Below are the scripts I normally load including git ssh agent.<\/p>\n\n\n\n
# ~\/.bash_profile\ntest -f ~\/.profile && . ~\/.profile\ntest -f ~\/.bashrc && . ~\/.bashrc\ntest -f ~\/.bash_aliases && . ~\/.bash_aliases<\/pre>\n\n\n\n# ~\/.bashrc\nenv=~\/.ssh\/agent.env\n\nagent_load_env () { test -f \"$env\" && . \"$env\" >| \/dev\/null ; }\n\nagent_start () {\n (umask 077; ssh-agent >| \"$env\")\n . \"$env\" >| \/dev\/null ; }\n\nagent_load_env\n\n# agent_run_state: 0=agent running w\/ key; 1=agent w\/o key; 2= agent not running\nagent_run_state=$(ssh-add -l >| \/dev\/null 2>&1; echo $?)\n\nif [ ! \"$SSH_AUTH_SOCK\" ] || [ $agent_run_state = 2 ]; then\n agent_start\n ssh-add ~\/.ssh\/id_rsa_git\nelif [ \"$SSH_AUTH_SOCK\" ] && [ $agent_run_state = 1 ]; then\n ssh-add ~\/.ssh\/id_rsa_git\nfi\n\nunset env<\/pre>\n\n\n\n# ~\/.ssh\/agent.env\nSSH_AUTH_SOCK=\/c\/Users\/Public\/Documents\/Wondershare\/CreatorTemp\/ssh-VmJtrCgHYMK8\/agent.12228; export SSH_AUTH_SOCK;\nSSH_AGENT_PID=9836; export SSH_AGENT_PID;\necho Agent pid 9836;<\/pre>\n\n\n\nUseful git aliases:<\/p>\n\n\n\n
# ~\/.bash_aliases\nalias ga=\"git add\"\nalias gaa=\"git add .\"\nalias gc=\"git commit -m\"\nalias gs=\"git status\"\nalias gcm=\"git checkout master\"\nalias glog5=\"git log --oneline -5\"\nalias gamendn=\"git commit --amend --no-edit\"\nalias gamend=\"git commit --amend\"\n\nalias glog5pretty=\"git log --pretty=format:\\\"%h%x09%an%x09%ad%x09%s\\\" -5\"\nalias gl=\"git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit\"\n\nalias wip=\"git add . && git commit -m 'wip'\"\nalias nah=\"git reset --hard && git clean -df\"\n\n#changing git ssh key\nalias ghswitchalex=\"ssh-add -D && ssh-add ~\/.ssh\/id_rsa_git && ssh -T git@github.com\"\nalias ghwhoami=\"ssh -T git@github.com\"<\/pre>\n","protected":false},"excerpt":{"rendered":"I use GitBash as my shell on Windows. Below are the scripts I normally load including git ssh agent. Useful git aliases:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"footnotes":""},"categories":[9],"tags":[],"class_list":["post-8168","post","type-post","status-publish","format-standard","hentry","category-system-administration"],"yoast_head":"\n
Loading Start Scripts for GitBash on Windows | Alex Rusin Blog<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n