Git使用用户名,路径和不同驱动器中的空格克隆ssh [英] Git clone ssh with spaces in username, path and different drive

查看:220
本文介绍了Git使用用户名,路径和不同驱动器中的空格克隆ssh的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有数量3 Windows 7专业机器。其中两台安装成安装了Git的开发机器(一台台式机和一台笔记本电脑)。第三个设置为安装了Git的文件服务器,另外它也作为ssh服务器运行。



我一直提到YouTube链接在Windows操作系统上创建Git服务器,我已经成功达到了16:15分钟的标记。为了总结视频中的这一点,我在所有3台机器上安装了Git,在文件服务器上安装了Bitvise SSH Server,在服务器上创建了一个--bare Git存储库,然后试图克隆远程(文件服务器)存储库到桌面文件夹。



我的问题是,如果在Git命令的用户名和路径中有空格,服务器?另外,服务器上的回购不在C:驱动器上。它在D:驱动器上。这是否会使事情变得复杂?



这不仅仅是一个在局域网上使用ssh的练习。我将使用它来访问(拉和推)来自台式机和笔记本电脑的回购,同时在局域网和笔记本电脑上,在需要时从外部和大约(广域网)。



我尝试了以下方法,并在互联网上找到了它们的所有组合,但都没有成功:

  git clonessh: //用户名@文件服务器/路径到/ repo
git克隆ssh://用户名@文件服务器/ d /路径到/ repo
git clonessh://用户名@文件服务器/ d:/路径到/ repo

我收到以下错误(例如使用上面的第一行):

 致命:'/ path to / repo'看起来不是git存储库
致命:无法从远程存储库读取。

请确保您拥有正确的访问权限并存在存储库。

我知道我拥有访问权限,因为我使用的是正确的用户名(当提示输入密码时)以及'Bitvise SSH服务器控制面板 - 活动日志'表示登录成功。

 来自[{mac address}]的连接:59251以Windows帐户FILE-SERVER\User Name登录。 

另外,文件服务器(--bare)存储库肯定存在于D:\path (dir)
info(dir)
objects(dir)

 
refs(dir)
config(文件)
描述(文件)
HEAD(文件)

我是否正确使用引号括起命令?



是否需要将'.git'添加到结尾目录? EG:repo.git。我注意到很多人都这样做。是个人喜好,一个不成文的标准还是要求?



最后,谈到Git时,路径区分大小写?



感谢您的帮助。

解决方案

好了,经过一段时间,我研究出了如何实现这一点。 / p>

  git clonessh://用户名@文件服务器:/ D / path to / repo.git

命令行中的Git与其他任何具有空格的命令没有区别。将它用引号引起来...更具体地说,如果使用特殊字符,双引号的限制更少。



在默认安装以外的驱动器上安装Git存储库( C:/)驱动器不会使事情复杂化。



文件扩展名'.git'是它的必备工具。



路径是否区分大小写?那么,当使用Windows时,大小写敏感不是问题。但是,对于你来说正确和没有错误(特别是在操作系统之间),总是最好反映区分大小写的做法。 IE:'A'与'a'不同。



最后,为了反映与安装Git不同的驱动器号,请在计算机名称和正斜杠。这是绊倒我的问题。



我希望这些信息可以帮助其他人。


I have quantity 3 windows 7 professional machines. Two are setup as development machines (one desktop and one laptop) with Git installed. The third is setup as a file server with Git installed plus it is also running as a ssh server.

I have been referring to the YouTube link Creating a Git Server on a Windows OS and I have successfully reached the 16:15 minute mark. To summarise up to this point in the video I have installed Git on all 3 machines, installed Bitvise SSH Server on the file server, created a --bare Git repository on the server and then tried to 'clone' the remote (file server) repository to a desktop folder.

My question is how do you articulate a Git command if there are spaces in the 'user name' and 'path' to the repo on the server? Additionally, the repo on the server is not on the C: drive. It is on the D: drive. Does this complicate things?

This is not just an exercise in using ssh over a LAN. I will be using this to access (pull and push) the repo from both the desktop and laptop whilst on the LAN and from the laptop whilst out and about (WAN) when needed.

I have tried the following and just about every combination thereof found on the internet without success:

git clone "ssh://user name@file-server/path to/repo"
git clone "ssh://user name@file-server/d/path to/repo"
git clone "ssh://user name@file-server/d:/path to/repo"

I am receiving the following error (when for example using the first line above):

fatal: '/path to/repo' does not appear to be a git repository
fatal: Could not read from the remote repository.

Please make sure you have the correct access rights and the repository exists.

I know I have access rights as I am using the correct user name (and password when prompted for it) plus the 'Bitvise SSH Server Control Panel - Activity Log' indicates a successful login.

Connection from [{mac address}]:59251 logged in as Windows account 'FILE-SERVER\User Name'.

Additionally, the file servers (--bare) repository definitely exists in the "D:\path to\repo" directory.

hooks (dir)
info (dir)
objects (dir)
refs (dir)
config (file)
description (file)
HEAD (file)

Am I correct in wrapping the command in quotes?

Do I need to add '.git' to the end of the directory? EG: "repo.git". I noticed a lot of people do this. Is it personal preference, an unwritten standard or a requirement?

And lastly, when it comes to Git is the path case sensitive?

Thank's for any help.

解决方案

Well, after some time I worked out how to accomplish this.

git clone "ssh://user name@file-server:/D/path to/repo.git"

Git at the command line is no different from any other command that has spaces in it. Enclose it in quotes... To be more specific, double quotes are less restrictive if using special characters.

Having a Git repository on a drive other than the default install (C:/) drive does not complicate things.

The file extension '.git' is required for it to work.

Is the path case sensitive? Well, when using windows case sensitivity is not a problem. But, for you to be correct and error free (especially between OS), it is always best to reflect the practice of case sensitivity. IE: 'A' is different to 'a'.

Finally, to reflect a different drive letter to that which Git is installed, place a colon between the computer name and the forward slash. This was the issue tripping me up.

I hope this information helps other.

这篇关于Git使用用户名,路径和不同驱动器中的空格克隆ssh的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆