Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hoganlong/11293023 to your computer and use it in GitHub Desktop.
Save hoganlong/11293023 to your computer and use it in GitHub Desktop.
Creating a local file based upstream remote for Git and GitHub for Windows

#Creating a local file based upstream remote for Git.

#####(This works with GitHub for windows without pushing to the web!)

###Set up the new bare repo on the on your local file system: (a bare repo has not workspace it is used for sharing only. By convention it has .git in the folder name since there is no .git sub-directory in the repositiory)

C:\ORIGIN >git init --bare MyProject.git
Initialized empty Git repository in C:/ORIGIN/MyProject.git/
C:\ORIGIN >cd MyProject.git

###Add the remote repository to your existing local git repo and push:

#####(On GitHub for windows you can just change the primary remote in the Repository settings screen to file://"C:/ORIGIN/MyProject.git")

C:\Projects\MyProject [master]> git remote add origin file://"C:/ORIGIN/MyProject.git"
C:\Projects\MyProject [master]> git push origin master

To file://C:/ORIGIN/MyProject.git
C:\Projects\MyProject [master]>
@CarlSmotricz
Copy link

git wouldn't accept the first command with "-bare" I think it should be "--bare" , and that worked OK for me.

@hoganlong
Copy link
Author

git wouldn't accept the first command with "-bare" I think it should be "--bare" , and that worked OK for me.

Thanks Carl -- updated.

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