Tuesday, March 24, 2009

setup cygwin

Not fun, but have to make cygwin work.
1. Here is the batch file to start cygwin.

@echo off

SET PATH=D:\disk\cygwin\bin;%PAtH%
SET HOME=D:\disk\markc
SET CYGWIN=tty binmode
chdir %HOME%

2. A no special .bash_profile in $(HOME).

# source the system wide bashrc if it exists
if [ -e /etc/bash.bashrc ] ; then
source /etc/bash.bashrc

# source the users bashrc if it exists
if [ -e "${HOME}/.bashrc" ] ; then
source "${HOME}/.bashrc"

3. Now, my .bashrc file.

export PATH=/usr/bin:/sbin:/usr/local/bin
export PATH=/usr/local/psp/gcc-2.8.2/bin:$PATH
export PATH=/usr/local/psp/devkit/bin:$PATH:.
export PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '

The problem I have is '\r' cause the problem to start cygwin. To make cygwin happy with unix file format, we need set the unix file format in vimrc. The following code is my vimrc.

set autoindent
set softtabstop=4
set tabstop=4
set shiftwidth=4
set showmatch
set ignorecase
set background=dark
set hlsearch
set incsearch
set number
syntax on
set fileformats=unix,dos
set fileformat=unix

Monday, March 23, 2009

generate ssh key for github

It looks to me that github is a good place to host open source. Also git is aimed to replace svn, so I would move to git from svn. (currently googlecode is with svn).

$ git config --global user.name "foo"
$ git config --global user.email "foo@gmail.com"
$ cd sur
$ git init
$ git add sur.w %my source code
$ git commit -m "first commit"
$ git remote add origin git@github.com:dsmarkchen/sur.git
$ git push origin master

I got permission denied error message. It is not very hard for me to figure it out.

1. try to connect to github by ssh (it helps to know the problem)

ssh -v git@github.com

2. generate the public key

$ cd ~/.ssh
$ ssh-keygen -t rsa

3. Add the the content of id_rsa.pub to github, then I am ready to see
the magic.