1

I am trying to create a local git server, that i will then clone and use it on my same machine.

I read this stackoverflow answer:

How to add a local repo and treat it as a remote repo

If your goal is to keep a local copy of the repository for easy backup or for sticking onto an external drive or sharing via cloud storage (Dropbox, etc) you may want to use a bare repository. This allows you to create a copy of the repository without a working directory, optimized for sharing.

$ git init --bare ~/repos/myproject.git

$ cd /path/to/existing/repo

$ git remote add origin ~/repos/myproject.git

$ git push origin master

So i went ahead in my D drive and done the following:

  1. Created a gitserver.git folder with the .git extension, its a folder.
  2. Ran $ git init --bare after i right clicked that folder and selected gitbash
  3. Created another folder inside the root D drive called gitclient.
  4. Right clicked inside gitclient and selected gitbash and tried to run
  5. git remote add origin D:/gitserver.git

Did not work i am getting

$ git remote add origin D:/gitserver.git
fatal: not a git repository (or any of the parent directories): .git

It probably has to do with the path.

If somebody posts an answer, please describe how to work with windows paths in gitbash, everybody thinks that linux is the only OS when dealing with git.

Liam
  • 27,717
  • 28
  • 128
  • 190
Aflred
  • 4,435
  • 6
  • 30
  • 43
  • *everybody thinks that linux is the only OS when dealing with git* just FYI GIT was designed by Linus Torvalds to manage the Linux kernal source code. It's even [named after him](https://www.quora.com/Why-is-Git-called-Git). So it's designed for use on Linux. Windows developers have just jumped on the bandwagon because it's considerably better than anything else (SVN) – Liam Jul 09 '18 at 15:46
  • You only created the `gitclient` folder but did not `git init` it. – jingx Jul 09 '18 at 17:44

1 Answers1

0

As commented, you need to create a git repo for gitclient.
This time, it should be a non-bare repo, since gitclient is supposed to check out the file of the first Git repo, the bare one, which will be an "upstream" repo.

# In D:/gitclient.git
git init .
# then
git remote add origin D:/gitserver.git
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250