Skip to content

Instantly share code, notes, and snippets.

@staplerfahrer
Forked from zarzen/create_git_repo.org
Last active December 30, 2020 16:17
Show Gist options
  • Select an option

  • Save staplerfahrer/bb41e332b9812629aa520ac109fdd923 to your computer and use it in GitHub Desktop.

Select an option

Save staplerfahrer/bb41e332b9812629aa520ac109fdd923 to your computer and use it in GitHub Desktop.
Create a Git repository base on any Windows shared folder
Step 1, create an environment variable for the repository directory:
set repo=\\serverName\share\repos\myRepo.git
Step 2, create the repository directory and open it:
mkdir %repo%
pushd %repo%
Step 3, initialize the bare, shared repository and go back to the local repository:
git --bare init --shared
popd
Step 4, push the local repository, master branch to the remote repository:
git push %repo% master
Step 5, define the remote origin for the local repository:
git remote add origin %repo%
If you ever need to move a remote repository, update your local copy's remote like so:
git remote -v
git remote set-url origin //newServerName/newShare/repos/myRepo.git
Reference

Git on windows:Creating a network shared central repository

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment