Skip to content

Instantly share code, notes, and snippets.

@tsuyo
Created October 4, 2021 11:58
Show Gist options
  • Save tsuyo/fe5109ad1a517a6f82dc87a336396417 to your computer and use it in GitHub Desktop.
Save tsuyo/fe5109ad1a517a6f82dc87a336396417 to your computer and use it in GitHub Desktop.
Create a git repo on local disk
#!/bin/sh
# variables
git_location=$1
proj_name=`basename $PWD`
# error check
[ "${git_location}" = "" ] && echo "usage: $0 <git_dir>" && exit
# git commands
git init
git add .
git commit -m "initial"
git clone --bare . ${git_location}/${proj_name}.git
git remote add origin ${git_location}/${proj_name}
git remote update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment