Coder,肖德时的个人BLOG

mysql,Linux,HighPerformance,ruby on Rails

2011年3月21日星期一

快速构建GIT仓库方法

老手请直接过滤,谢谢

Create remote repository:

ssh mpapis@niczsoft.com -C "git init --bare repos/library3.git"

Create local repository:

git init
git add .
git commit -m "initial commit"

Tell local repository to synchronize with remote repository:

git remote add origin mpapis@niczsoft.com:repos/library3.git
git config branch.master.remote origin
git config branch.master.merge refs/heads/master
git push

参考这个:

http://niczsoft.com/2011/03/fastest-way-to-get-git-server-v2/


--
Deshi Xiao
Twitter: xds2000
E-mail: xiaods(AT)gmail.com

2011年2月28日星期一

能让我把git库同步到svn的步骤,内幕版

把git同步到svn的想法有好久了,就是没成功。那叫一个不爽。

今天从GL挖来惊喜:

步骤:

1. cd  $git-workdir
$git-workdir就是你本地的git目录,注意branch要在master,我只同步到trunck.说白了只同步,不使用SVN

2.git svn init --username=$username https://remote-testbed.googlecode.com/svn/trunk/$git-workdir

3.git svn fetch
 r11 = 37275f86ebaa13616554dc5ddbeb1112d6e897f3 (git-svn)
我这里还出worning,没办法等。。。。

4.git branch svn/master master

5.在当前目录跑这个叫本就可以。
 #!/bin/sh

HEAD
="$(git symbolic-ref HEAD)" || exit 1

die()
{
        echo
"git-svn-update: $*"
       
exit 1
}

git svn fetch
|| die "failed to fetch SVN changes"
git branch
-f svn/tmp master || die "failed to update/create temporary working branch"
git rebase
--onto git-svn svn/master svn/tmp || die "failed to rebase on top of git svn branch"
git svn dcommit
|| die "failed to update SVN repository"
git branch
-f svn/master master
git checkout
"${HEAD#refs/heads/}"
git branch
-D svn/tmp
6.done.


--
Deshi Xiao
Twitter: xds2000
E-mail: xiaods(AT)gmail.com

2010年12月24日星期五

authlogic with rails3,遇到问题,找到方法,解决之路

authlogic是认证gem,是当前最普遍使用的一款工具包,对rails3集成还不是很完美。(特对rails3.0.3+ruby1.9.2p0)
这里特意把相关的参考资料索引在这里,方便你来使用:

http://asciicasts.com/episodes/160-authlogic
这里思路和代码都比较完整。

https://github.com/binarylogic/authlogic
authlogic的codebase

http://www.dixis.com/?p=352
这个提到了使用rails3_generators

http://techoctave.com/c7/posts/37-authlogic-and-rails-3-0-solution
这个提到了问题的根源和解决方法

--
tommy xiao
E-mail: xiaods(AT)gmail.com

2010年12月5日星期日

Git使用过程中遇到的问题及解决方法

1、在github上fork过的项目创建branch
参考[1]

2、使用less看的log不是彩色的,使用less -R log/development.log就可以。
参考[2]

[1] http://www.zorched.net/2008/04/14/start-a-new-branch-on-your-remote-git-repository/
[2] http://www.sanityinc.com/articles/view-rails-logs-with-less
--
tommy xiao
E-mail: xiaods(AT)gmail.com

2010年11月21日星期日

rails3 Nested Forms blah blah

Rails3 UJS and nested form, I have searched more sample like,eg: this.
I found all reference's source is Ryan Bates nested form exmaple,based in github. but in rails3,i came crome this view [1]. it's all sucks.
the cause reason is the hidden temple default value is false.when sumit action,the hidden values will not discard,and continue update this params.
i see the log,i think maybe some validation is wrong. oh,i found the original accepts_nested_attributes_for is
reject_if => lamda {|a| a.values.all?(&:blank?)}
this is blocker question.
i change the evalution assert to :
reject_if => proc {|a| a[:name].blank? }
attention,the:name is task's attribute name.
this is indicate original code is not working on rails3.
this is all.done.for your convinent test,i have attached my sample deme.have a try.

1.see attached project-nestform.png
2.nestform4rails3.zip

--
tommy xiao
E-mail: xiaods(AT)gmail.com

2010年10月18日星期一

SSH With PublicKey issue:SSH Error: Permission denied (publickey,gssapi-with-mic) resolve way.

今天给一个服务器加public key认证。出错:
Permission denied (publickey,gssapi-with-mic)
sshd_config配置是以前的备份,不会有错,就是过不去。网上一大堆出招的,但均无效果。
回到问题报错提示,这个应该是权限,但哪里呢?
最后还是这里给了提示
make sure that the *right* permissions are set up

drwx------ 2 virender virender 4096 May 7 04:51 .ssh
-rw------- 1 virender virender 393 May 7 03:41 .ssh/authorized_key

还有不少人遇到我这个问题,但都没人解决.

其实就是.ssh目录权限如果太大,sshd是不让使用公钥认证的。
所以,在你配置完之后,这样处理:
$ chmod go-w ~/
$ chmod 700 ~/.ssh
$ chmod go-rwx ~/.ssh/*
OpenSSH may also refuse to support public key authentication if the file permissions are too open.
OpenSSH在文件权限属性太开放,还是会拒绝支持公钥认证。

Done.


--
tommy xiao
E-mail: xiaods(AT)gmail.com