Skip to content

Instantly share code, notes, and snippets.

@harrytallbelt
Last active November 8, 2017 13:44
Show Gist options
  • Save harrytallbelt/bab45ef5ba0206657a3a0383b97ae317 to your computer and use it in GitHub Desktop.
Save harrytallbelt/bab45ef5ba0206657a3a0383b97ae317 to your computer and use it in GitHub Desktop.
Create a local bare repo, you can (put in Dropbox folder) use like remote.
# Create a new bare repo.
cd origin-parh
mkdir repo.git
cd repo.git
git --bare init
# Make an already existing repo bare.
cd origin-parh
mkdir repo
cd repo
git init
cd ..
mv repo/.git repo.git
rm -rf repo
cd repo.git
git config --bool core.bare true
# Working with a bare repo.
cd working-path
git clone origin-path/repo.git
echo 'Changes' > new-file.txt
git commit -a -m "Commit"
git push origin master
# (Re)setting remote
cd working-path/repo
git remote remove origin
git remote add origin origin-path/repo.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment