开发者

GIT clone - failure and deleted the target folder

开发者 https://www.devze.com 2023-04-04 07:09 出处:网络
I am trying to do a GIT clone (I am new to GIT) The command I use is: C:\\GIT>git clone --bare \\\\NAS1\\GIT\\OptiTexRepo \\\\backupnas\\backup\\GIT

I am trying to do a GIT clone (I am new to GIT)

The command I use is:

C:\GIT>git clone --bare \\NAS1\GIT\OptiTexRepo \\backupnas\backup\GIT

Inside the \BACKUPNAS during the run I get several folders created. When they end, I get an error in my CMD windows

Cloning into bare repository \\backupnas\backup\GIT...
fatal: '\optitexnas\GIT\OptiTexRepo' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

And the folder on BACKUPNAS is deleted.

Running with --verbose does not add any new data to the screen.

What am I missing please? What should the correct syntax be if I want to create a backup of my GITREPO?

  • The GITREPO is located on a shared folder in our NAS (Ready开发者_JS百科nas 1100 by Netgear)
  • The server I run the command from has GIT installed and is a W2K3

EDIT: It looks like the entire project is been copied, and at the end (after all the files are copied, I get the error message0 and than the entire directory is deleted again.


As long as OptiTexRepo is really a repository:

Always use forward slashes for network paths when accessing them with msysgit:

git clone --bare //NAS1/GIT/OptiTexRepo //backupnas/backup/GIT

This should clone OptiTexRepo into your backupnas.

Furthermore, in your comment on your question, you write that you have several repos present on NAS1 that you might back up. So it would be a good idea to give the clone a meaningful name:

git clone --bare //NAS1/GIT/OptiTexRepo //backupnas/backup/GIT/OptiTexRepo.git

Another point: just cloning will put the current state of OptiTexRepo to backupnas, but does not backup future states of the repo. The best way of backing up a git repo is working with it:

  • git clone //NAS1/Git/OptiTexRepo D:/OptiTex will create a working copy under D:/OptiTex
  • work and git commit in this repo (D:/OptiTex)
  • occasionally push your changes to the NAS using git push --mirror origin
  • Hey presto! Created a backup of D:/OptiTex on //NAS1/Git/OptiTexRepo
0

精彩评论

暂无评论...
验证码 换一张
取 消