Skip to content

Instantly share code, notes, and snippets.

@zarzen
Last active March 5, 2024 00:22
Show Gist options
  • Save zarzen/e60ff6824ff7c7424e25 to your computer and use it in GitHub Desktop.
Save zarzen/e60ff6824ff7c7424e25 to your computer and use it in GitHub Desktop.
Create a Git repo base on windows shared folder

Reference

http://elegantcode.com/2011/06/18/git-on-windows-creating-a-network-shared-central-repository/

Step 1: Go to the remote shared folder

using `pushd` command

pushd \\remoteServer\git\Share\Folder\Path

Step 2: Create a folder to store repository

mkdir MyGitRepo1

Step 3: Go into the repo folder then initialize the repository

cd MyGitRepo1
git init --bare

Step 4: Back to local repository

popd

Step 5: Add remote uri then push to remote repository

note: using ‘/’ rather than ‘\’ in uri

git remote add origin //remoteServer/git/Share/Folder/Path/MyGitRepo1 
git push origin --all
@staplerfahrer
Copy link

zarzen, I found your guide really useful. One remark, maybe a useful change you could make: according to https://git-scm.com/docs/gitglossary#gitglossary-aiddefbarerepositoryabarerepository, a bare repo directory name conventionally has the extension .git

@jfmatth
Copy link

jfmatth commented Apr 9, 2021

thank you for this, just what i needed.

@ksadil
Copy link

ksadil commented Mar 17, 2022

Using this arrangement, can you issue pull requests?

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