我怎样才能在Windows上设置一个git仓库,然后在Mac OSX上推送它 [英] How can I set up a git repository on windows, and then push to/pull from it on Mac OSX

查看:200
本文介绍了我怎样才能在Windows上设置一个git仓库,然后在Mac OSX上推送它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图建立一个基于Windows的网络服务器,但在Mac OSX上进行开发工作。我在Windows服务器上安装了freeSSHd和msysGit,并在需要的地方设置了一个存储库。我也有我的Mac上的git,并在那里建立了一个回购站。当我尝试通过SSH克隆,拉出或推送到windows repo时,它给了我一个错误,致命的:协议错误:坏行长度字符无论我在客户端设置远程设备如何Mac OSX)机器 - 我可以将它指向一个不存在的文件夹,它仍然会给我那个错误。



我也在Linux盒子上试过坐在身边,它完美的工作,所以它不是我的Mac。



我有一些想法:


  1. 也许freeSSHd的行为不正确(按建议这里),所以我可以得到一个不同的SSH服务器的Windows - 也许OpenSSH的


  2. 也许我打字的代码,结合Mac和Windows文件路径不正确。我试过:

    sudo git clone ssh://username@xx.xxx.xxx.xxx/C:/ Users / [my_username] / [remote_repo_name] /.git [destination]





    sudo git clone ssh://username@xx.xxx.xxx.xxx/C:\Users\ [my_username] \ [remote_repo_name] \.git [目的地]



    我得到的错误与这两者相同。


有人知道发生了什么问题吗?更好的是,有没有人设法做我想做的事(通过SSH推送和从Windows资源库中拉出来)?



谢谢! gitolite


  1. 作为先决条件,gitolite要求 ssh user @ remote git --version 作品

  2. gitolite使用一个有趣的ssh配置属性,从%HOME%/。ssh / authorized_keys 文件

你不能只复制你的公钥(即在 authorized_keys 中),但你也可以引用一个脚本来执行你的ssh命令:

 > more authorized_keys 
command =path / to / any / script / you / wantssh-rsa AAAAB3N; ... A_long_key..J6U19Jsf / kuO99XIrNE4ePzHw ==用户名@ pc_hostname

这意味着您将尝试使用该远程程序的任何ssh命令 ssh user @ remote dir 实际上会调用该脚本在远程(PC)计算机上。
(如果它是一个Perl脚本,它可以调用 system(your_command)来真正执行您需要)

通过该脚本,您可以显示和控制(并调试)任何可能影响您尝试执行的命令结果的环境变量通过ssh。

作为(Perl)脚本的示例,您可以通过 .gitolite / src / gl-auth-command ssh(假设它在你的公钥之前在你的 authorized_keys 文件中)声明


I'm trying to set up a Windows-based web server, but do the development work on Mac OSX. I installed freeSSHd and msysGit on the Windows server, and set up a repository where I want it. I also have git on my Mac and set up a repo there too. When I try to clone, pull from, or push to the windows repo via SSH, it gives me an error, "fatal: protocol error: bad line length character" It doesn't matter what I set the remote to in my client (Mac OSX) machine - I can point it to a folder that doesn't exist and it still gives me that error.

I also tried this on a Linux box I have sitting around and it works perfectly, so it's not my Mac.

I have a couple ideas:

  1. Maybe freeSSHd isn't behaving correctly (as suggested here) so I could get a different SSH server for Windows - perhaps OpenSSH

  2. Perhaps I'm typing the code that combines Mac and Windows file paths incorrectly. I tried:
    sudo git clone ssh://username@xx.xxx.xxx.xxx/C:/Users/[my_username]/[remote_repo_name]/.git [destination]

    and

    sudo git clone ssh://username@xx.xxx.xxx.xxx/C:\Users\[my_username]\[remote_repo_name]\.git [destination]

    I'm getting the same error with both of these.

Does anybody know what's going wrong? Better yet, is there anybody out there that has managed to do what I want to do (push to and pull from a windows repository via SSH)?

Thanks!

解决方案

I have not done that kind of setup (my ssh server is a Solaris10 one), but I have found most ssh error while trying to setup gitolite.

  1. as a prerequisite, gitolite demands that ssh user@remote git --version works
  2. gitolite uses an interesting ssh configuration property, from the %HOME%/.ssh/authorized_keys file

You can not just copy your public key there (ie in "authorized_keys"), but you can also reference a script to execute for your ssh command:

> more authorized_keys
command="path/to/any/script/you/want" ssh-rsa AAAAB3N;...A_long_key..J6U19Jsf/kuO99XIrNE4ePzHw== username@pc_hostname

Meaning any ssh command you will try on that remote ssh user@remote dir will actually call that script on the remote (PC) computer.
(if it is a Perl script, it can then call system(your_command) to actually execute what you need)

From that script, you can display and control (and debug) any environment variable that might influence the outcome of the command you are trying to execute through ssh.
See .gitolite/src/gl-auth-command as an example of (Perl) script you can call through ssh (provided it is declare before your public key in your authorized_keys file)

这篇关于我怎样才能在Windows上设置一个git仓库,然后在Mac OSX上推送它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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