Search
Categories
Ad

Posts Tagged ‘git’

share repositories in windows with osx using “git push”

Wednesday, June 17th, 2009

Problem

You have a git repos in Windows XP, and you want to share that with your MacOSX machine. The easiest way seems git clone in MacOSX. However, my win repos are in D drive and I did not find out how to write the repos path. I did

git clone tomoya@windows:d:\home\git.git
git clone tomoya@windows:d:\\home\\git.git
git clone tomoya@windows:d:/home/git.git
git clone tomoya@windows:"d:/home/git.git"

but all failed in vain.

Thus, I changed my mind to use git push from Windows.

Solution

SSH server on Windows

First, if you have not installed cygwin, or any SSH server for Windows, install freeSSHd. This programs runs on Windows as a SSH server.

create repository in MacOSX

[MacOSX]
tomoya@macosx% cd ~/Workspace/git
tomoya@macosx% git init

Add remote repository

[Windows]
D:\home\git> git remote add origin tomoya@macosx:/Users/tomoya/Workspace/git

Try connectiing to remote

[Windows]
D:\home\git> git remote show origin

Then I got a error as

Permission denied (publickey,keyboard-interactive).
fatal: The remote end hung up unexpectedly

This is because my MacOSX requires key authentication. So, I specified pub.key files just by creating config file in %HOME%/.ssh/.

[Windows]
D:\home\git> notepad "%HOME%\.ssh\config"

and, type

Host 192.168.1.21
  User tomoya
  Port 22
  Hostname 192.168.1.21
  IdentityFile C:/id_rsa
  TCPKeepAlive yes
  IdentitiesOnly yes

Try connecting again.

[Windows]
D:\home\git> git remote show origin
zsh: command not found: git-upload-pack
fatal: The remote end hung up unexpectedly

Great. I had these errors because my default login shell on MacOSX is zsh and my zsh does not know where git-upload-pack command is. Check whether git-upload-pack is installed correctly.

[MacOSX]
tomoya@macosx% which git-upload-pack
/opt/local/bin/git-upload-pack

OK. Now check if i have .zshenv file in your home directory.

[MacOSX]
tomoya@macosx% cat ~/.zshenv
cat: /Users/tomoya/.zshenv: No such file or directory

I do not. So I made a symbolic link to .zshenv.

[MacOSX]
tomoya@macosx% ln -s ~/.zshrc ~/.zshenv

More detailed infomation about .zshrc and .zshenv can be found at here: http://zsh.dotsrc.org/Intro/intro_3.html.
Try connecting fot the third time.

[Windows]
D:\home\git> git remote show origin
* remote origin
  URL: tomoya@192.168.1.21:/Users/tomoya/Workspace/git
  HEAD branch: master
  Remote branch:
    master tracked
  Local ref configured for 'git push':
    master pushes to master (up to date)

Hoora! We made it. Ok, move on to next task.

Push to OSX

[Windows]
D:\home\git> git push origin master

And on MacOSX,

[MacOSX]
tomoya@macosx% ls ~/Workspace/git

If you see no files in this directory, this is because pushed files are deleted temporarily, so revert all the files as

[MacOSX]
tomoya@macosx% git reset --hard HEAD

That’s all. Now you have the second repos in your Mac OSX.

gisty for gist and gisty for Ruby1.9.1

Sunday, June 14th, 2009

Introduction

gist is a simple web service by github for posting and sharing your cool code snippets. gisty is a command-line client for gist.

Installation of gisty

sudo gem install nokogiri
sudo gem sources -a http://gems.github.com
sudo gem install swdyh-gisty

Usage

Posting a source code is as easy as

 gisty post hello.c world.c

Also, you can ‘clone’ all your code snippets.

 gisty sync

For more information, type

 gisty help





And the problem is…

Problem

gisty does not work with Ruby1.9.1.

Solution

I made a forked version of gisty on github repos. Soon, you will be able to download this version

sudo gem install tomoya55-gisty

Notice: you cannot install tomoya55-gisty at this moment. I am now investigating what is going on on my gems. Thank you.