Reputation: 8797
I have my local development repo on Windows at C:\Dev\myrepo
, that was cloned from the remote repo is at [email protected]:myrepo.git
. I’m getting ready to deploy it and I'd like to clone the repo in a different location, C:\Publish\myrepo
so that it's completely clean.
What I'd like to do is:
I've read a few things about --reference and --bare and --share, and it is hard to be certain whether things are going to really do what I expect them to do.
Will the following command do what I want?
cd /c/Publish
git clone --reference /c/Dev/myrepo [email protected]:myrepo.git
Upvotes: 0
Views: 277
Reputation: 158100
You can follow these steps:
cd '/c/Publish'
# Clone the local repository. origin points now to '/c/Dev/myrepo'
git clone '/c/Dev/myrepo'
# Remove the local origin
git remote rm origin
# Add the remote origin
git remote add origin [email protected]:myrepo.git
# Assuming the master branch was cloned,
# you need to set that up to track the remote master
git branch --set-upstream-to=origin/master master
# Tracking for other branches will be set up automatically with a pull
git pull
Upvotes: 3