Home > Software design >  Locally cloned repository not syncing
Locally cloned repository not syncing

Time:01-10

I have a .git repository and when a clone it, its not syncing. When i run "git branch", i'm receiving the branch "master", but that it's not sync when i make changes in the original project folder.

how can i sync the master branch in another directory?

My directory tree:

folder
 |_ Project
 |    |_ .git
 |
 |_ Another Folder 
 |    |_ Project
 |         |_ .git

commands that i runed:

PS c:Another Folder>: git clone "c:Project/.git"

CodePudding user response:

For cloning a remote (or local) repository, it must be setup as "bare". Without this initial condition you can't clone from it.

In order to clone from a local repository, you can use the following command: git clone --local {path-to-repo}. This will create a clone which you can use for regular git tasks (add, rebase, merge, push, etc.).

Note that you can also convert an existing regular (cloned) repository to a bare repository for cloning with git config --bool core.bare true.

EDIT:

As pointed out in the comment section (@LeGEC), you actually can clone from a non bare repo. However, you will not be able to issue git push commands on the checked out branch.

  •  Tags:  
  • git
  • Related