How can I set up a git repository on windows, and then push to/pull from it on Mac OSX

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.

  • Git add submodules to super project from existing repos
  • Are there any good, cross platform, Mac, Win32, *nix, Git GUI clients?
  • What's the best CRLF (carriage return, line feed) handling strategy with Git?
  • Maintain a separate branch for each platform
  • Cross platform git hooks
  • How to handle dependencies in cross platform C++ projects?
  • 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!

  • Git: copy all files in a directory from another branch
  • Is there any way to get git to work directly with a .pac (proxy auto-config) script?
  • Adding git commit message to all files (even unchanged)
  • How to recover a dropped stash in Git?
  • svn to git conversion
  • Unconsistent git-checkout of remote branches
  • 2 Solutions collect form web for “How can I set up a git repository on windows, and then push to/pull from it on Mac OSX”

    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)

    Just to suggest something outrageous, what about not using ssh and instead use file sharing. Macs can access Windows shares and git can work of a physical path (which is what a windows share would appear like).

    Git Baby is a git and github fan, let's start git clone.