SSH Keys
SSH key 可以让你在你的电脑和 Git @ OSC 之间建立安全的加密连接。
( 注意切换到运行PHP 的 APACHE 或者 WWW 用户下面运行生成设置)
你可以按如下命令来生成sshkey
ssh-keygen -t rsa -C "xxxxx@xxxxx.com"# Creates a new ssh key using the provided email # Generating public/private rsa key pair...
查看你的public key,并把他添加到 Git @ OSC http://git.oschina.net/keys
cat ~/.ssh/id_rsa.pub # ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6eNtGpNGwstc....
添加后,在终端(Terminal)中输入
ssh -T git@git.oschina.net
若返回
Welcome to Git@OSC, yourname!
则证明添加成功。
通过这种方式,以后使用SSH提交时就不需要录入用户名和密码。如果之前使用https的,要修改为SSH, 只需要把项目中.git/config文件中的url改成ssh链接即可。
WebHooks设置
回调程序执行代码
exec('/usr/local/git/bin/git push git@git.oschina.net:***/***.git --progress > release.log 2>&1', $output, $return);