msysgit 的麻烦
所以我似乎在设置 msysgit 时遇到了一些实际问题。我可以使用 putty 连接到我的 SSH 目录
ssh://用户@主机:端口
我有正确的密钥。我也可以使用 plink 通过
plink -P PORT user@host -i /path/to/private_key.ppk
当我尝试运行(通过 TortiseGIT)或通过 git bash 时
git 克隆 ssh://user@host:port/path/to/myapp.git
我只是不断收到错误
在 D:/Git/myapp.git 中初始化空 Git 存储库
警告:您似乎克隆了一个空存储库。
fatal:远端意外挂断
我检查了 bot /Git/setup.ini 和 TortiseGIT 并且都使用
C:\Program Files\TortoiseSVN\bin\TortoisePlink.exe
有谁知道我如何解决这个问题,因为它让我发疯!
So I seem to have some real issues setting up msysgit. I can connect via putty to my SSH directory using
ssh://user@host:port
And I have the correct keys. I can also do this using plink via the
plink -P PORT user@host -i /path/to/private_key.ppk
When I attempt to run (via TortiseGIT) or via a git bash
git clone ssh://user@host:port/path/to/myapp.git
I just keep getting the error
Initialized empty Git repository in D:/Git/myapp.git
warning: You appear to have cloned an empty repository.
fatal: The remote end hung up unexpectedly
I have checked bot /Git/setup.ini and TortiseGIT and both use
C:\Program Files\TortoiseSVN\bin\TortoisePlink.exe
Does anyone know how I can fix this problem as its driving me nuts!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
以下是一些检查列表:
您的 ssh 密钥是否位于 GIT 的正确位置?
建议:
1:由于您可以使用 putty 连接,看起来 ssh 设置正常。
2:使用putty连接服务器。输入
git --version
您会得到合理的响应吗?如果没有,那么您需要将其安装在服务器上。3:尝试在服务器上设置新的存储库。假设它是一个 *nix 风格的服务器,使用 putty 并连接到服务器并使用以下命令创建一个新的存储库,假设您有一个目录 /home/source_code。 echo 行只是创建一个包含少量文本的文件,因此我们有一些可以开始的东西。
现在我们有了一个存储库,其中包含一个 t.txt 文件。通常,您永远不应该推送到包含工作副本更改的存储库。在服务器上拥有存储库的目的是让人们可以随时推送到它。我们创建一个“裸”克隆,它只是 git 数据库,这样就不可能更改任何工作副本。我们将使用这个“裸”克隆作为中央 git 存储库。
您现在可以删除我们设置的临时存储库。
在本地计算机上再次尝试克隆
4:权限:这不会导致克隆、获取或拉取问题,除非您为存储库选择了没有读取访问权限的位置。如果您在推回时收到“权限被拒绝”错误,请参阅 权限更正
5:设置 GIT 的公钥/私钥:
chmod 700 .ssh< /code>
chmod 600authorized_keys
ssh-keygen -t dsa
cat id_dsa.pub >>> .ssh/authorized_keys
PubkeyAuthentication yes
sudo /etc/init.d/ssh restart
id_dsa
和id_dsa.pub
从服务器到本地硬盘(使用 wincp 或 sftp 或某些此类工具) c:\users\userName\.ssh 目录(这是对于 vista,其他版本的 windows 的位置会有所不同)命令行 git 和 tortoise git 都应设置为工作。在本地计算机上再次尝试克隆。
您现在可能想要使用密码重复设置密钥......
Here is a bit of a check list:
Do you have the ssh keys in the right place for GIT?
Suggestions:
1: Since you can connect using putty, looks like ssh is setup ok.
2: Use putty and connect to the server. Type in
git --version
Do you get back a reasonable response? If not then you will need to install it on the server.3:Try setting up a new repository on the server. Assuming its a *nix style server use putty and connect to the server and make a new repository using the following commands, assuming you have a directory /home/source_code. The echo line just makes a file with a little bit of text in it so we have something to start with.
So now we have a repository with one t.txt file in it. As a rule you should never push into a repository that contains changes to the working copy. The purpose of having a repository on the server is so that people can push into it all the time. We make a "bare" clone which is only the git database, that way there is no possibility of any working copy changes. It is this "bare" clone that we will use as the central git repository.
You can now get rid of the temporary repository that we set up.
On your local computer try cloning again
4: Permissions: This should not cause a problem with cloning, fetching or pulling, unless you have selected a location for the repository that doesnt have read access. If you get a Permission denied error when pushing back then refer to Permissions correction
5: Setting up public/private key for GIT:
chmod 700 .ssh
chmod 600 authorized_keys
ssh-keygen -t dsa
cat id_dsa.pub >> .ssh/authorized_keys
PubkeyAuthentication yes
sudo /etc/init.d/ssh restart
id_dsa
andid_dsa.pub
from the server to your local hard drive (use winscp or sftp or some such tool) c:\users\userName\.ssh directory (this is for vista the location will be a bit different for other versions of windows)Both the command line git and tortoise git should be setup to work. Try cloning again on your local machine.
You might now want to go and repeat setting up the keys with a passphrase....
您需要安装 Pageant 并将密钥添加到其中。
还要仔细检查您的 GIT_SSH 环境变量是否设置为使用 plink
You need to install Pageant and add the key into it.
Also double check that your GIT_SSH environment variable is set up to use plink
远程仓库中是否有任何内容(即至少一次提交)?
git 说:“警告:您似乎克隆了一个空存储库”
,当您想推送到空远程存储库时,您必须使用:
Is there anything (i.e. at least one commit) in the remote repo ?
git says: "warning: You appear to have cloned an empty repository"
and when you want to push into the empty remote repo you have to use:
您是否尝试过使用 ssh user@host:port 从 Git-Bash 连接?是直接连接还是要求输入密码?
仅当您使用非标准端口进行 ssh 时才需要端口,否则它将默认为 22。这是 Putty 的一件事,但请确保您可以从 git bash 连接,因为它通常在 .ssh 中有自己的密钥存储目录离开您的用户目录。如果您无法通过 Git-Bash 使其正常工作,则需要修复密钥或调试问题所在,
密钥,请尝试使用ssh -i keyfile user@host:port
如果不起作用或提示您输入 指定密钥远程计算机上的密码意味着密钥交换无法正常工作。因此,您需要检查 Git-Bash 环境的密钥设置是否正确。特别要确保您已导出 RSA 密钥,而不仅仅是在 Git-Bash 中使用 ppk 密钥。我不相信这是得到支持的。我不使用 Tortoise-Git,所以我无能为力,但我确实经常使用 Git Bash。
Have you tried connecting from Git-Bash with ssh user@host:port? Does it connect directly or ask for a password?
Port is only required if you are using a non-standard port for ssh otherwise it will default to 22. It is one thing from Putty but make sure you can connect from git bash because it will generally have its own key store in a .ssh directory off of your user directory. If you cannot get that to work from Git-Bash you need to fix the key or debug where the problem is, try specifying the key by using
ssh -i keyfile user@host:port
if that doesn't work or prompts you for a password on the remote machine it means the key exchange is not working properly. So you need to go through checking the keys are setup properly with regards to the Git-Bash environment. In particular make sure that you have exported the RSA key and are not just using the ppk key with Git-Bash. I do not believe that is supported. I don't use Tortoise-Git so I can't help with that, but I do use Git Bash regularly.