20100904

自动pull全部git工程:技术选择和放弃-故障定位

自动pull全部git工程:技术选择和放弃-故障定位


** git mail
*** mail list
**** http://sourceforge.net/apps/trac/sourceforge/wiki/Git
无动作.配置成本地git也未收到邮件.
**** http://pkill.info/b/1473/setting-up-git-commit-email-notification/
[hooks]
mailinglist = "email1@example.com email2@example.com"
senderemail = "owner@exmaple.com"
**** http://source.winehq.org/git/tools.git/?a=blob_plain;f=git-notify;hb=HEAD
wine开发组用的。执行后停住不动。
** 邮件通知一直失败,做了个脚本,以后每天执行一次,pull更新GIT本地repository。
: echo ------------------------
: echo ec
: cd ec
: git pull .
: cd ..
:
: echo ------------------------
: echo gitadmin/gitosis-admin
: cd gitadmin/gitosis-admin
: git pull origin
: cd ../..
:
: echo ------------------------
: echo gittest/gittest
: cd gittest/gittest
: git pull .
: cd ../..
:
: echo ------------------------
: echo movie
: cd movie
: git pull .
: cd ..
:
: echo ------------------------
: echo patent_monkeyking
: cd patent_monkeyking
: git pull .
: cd ..
:
: echo ------------------------
: echo spr
: cd spr
: git pull .
: cd ..
:
: echo ------------------------
: echo story9000s
: cd story9000s
: git pull .
: cd ..
:
: echo ------------------------
: echo uv
: cd uv
: git pull .
: cd ..
:
: echo web程序设计_网络课程
: cd web程序设计_网络课程
: git pull .
: cd ..
:
: echo ------------------------
: echo 马赛克人名.自动调节曝光时间和电压时间
: cd 马赛克人名.自动调节曝光时间和电压时间
: git pull .
: cd ..


** git pull remote?? config
CLOCK: [2010-09-04 周六 17:20]--[2010-09-04 周六 20:33] => 3:13
*** git bash & gui 不能pull,而tortoise 能
*** git pull -v repository branch ?
*** git remote -v
*** git config -l
*** 找到原因,是因为putty自动载入了[C:\Users\ibm\.ssh\]下的 private key [2010-09-04 周六 19:36]
gittest & gitadmin 是用 aa 的账号连接的。
*** tried to copy young.ppk to user ibm's home .ssh directory. failed
for different format.
*** bash uses ssh, not Putty

: $ ssh -v git@[马赛克_服务器的IP]
: OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
: debug1: Connecting to [马赛克_服务器的IP] [[马赛克_服务器的IP]] port 22.
: debug1: Connection established.
: debug1: identity file /c/Users/ibm/.ssh/identity type -1
: debug1: identity file /c/Users/ibm/.ssh/id_rsa type -1
: debug1: identity file /c/Users/ibm/.ssh/id_dsa type -1
: debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3
: debug1: match: OpenSSH_4.3 pat OpenSSH*
: debug1: Enabling compatibility mode for protocol 2.0
: debug1: Local version string SSH-2.0-OpenSSH_4.6
: debug1: SSH2_MSG_KEXINIT sent
: debug1: SSH2_MSG_KEXINIT received
: debug1: kex: server->client aes128-cbc hmac-md5 none
: debug1: kex: client->server aes128-cbc hmac-md5 none
: debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
: debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
: debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
: debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
: debug1: Host '[马赛克_服务器的IP]' is known and matches the RSA host key.
: debug1: Found key in /c/Users/ibm/.ssh/known_hosts:1
: debug1: ssh_rsa_verify: signature correct
: debug1: SSH2_MSG_NEWKEYS sent
: debug1: expecting SSH2_MSG_NEWKEYS
: debug1: SSH2_MSG_NEWKEYS received
: debug1: SSH2_MSG_SERVICE_REQUEST sent
: debug1: SSH2_MSG_SERVICE_ACCEPT received
: debug1: Authentications that can continue: publickey,gssapi-with-mic,passwor
: debug1: Next authentication method: publickey
: debug1: Trying private key: /c/Users/ibm/.ssh/identity
: debug1: Trying private key: /c/Users/ibm/.ssh/id_rsa
: debug1: Trying private key: /c/Users/ibm/.ssh/id_dsa
: debug1: Next authentication method: password
: git@[马赛克_服务器的IP]'s password:

*** convert young.ppk into young_openssh as OpenSSH Key
:
: ibm@IBM-THINK c:/Users/ibm/Documents/git/ec (master)
: $ ssh -v git@[马赛克_服务器的IP]
: OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
: debug1: Connecting to [马赛克_服务器的IP] [[马赛克_服务器的IP]] port 22.
: debug1: Connection established.
: debug1: identity file /c/Users/ibm/.ssh/identity type -1
: debug1: identity file /c/Users/ibm/.ssh/id_rsa type -1
: debug1: identity file /c/Users/ibm/.ssh/id_dsa type -1
: debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3
: debug1: match: OpenSSH_4.3 pat OpenSSH*
: debug1: Enabling compatibility mode for protocol 2.0
: debug1: Local version string SSH-2.0-OpenSSH_4.6
: debug1: SSH2_MSG_KEXINIT sent
: debug1: SSH2_MSG_KEXINIT received
: debug1: kex: server->client aes128-cbc hmac-md5 none
: debug1: kex: client->server aes128-cbc hmac-md5 none
: debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
: debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
: debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
: debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
: debug1: Host '[马赛克_服务器的IP]' is known and matches the RSA host key.
: debug1: Found key in /c/Users/ibm/.ssh/known_hosts:1
: debug1: ssh_rsa_verify: signature correct
: debug1: SSH2_MSG_NEWKEYS sent
: debug1: expecting SSH2_MSG_NEWKEYS
: debug1: SSH2_MSG_NEWKEYS received
: debug1: SSH2_MSG_SERVICE_REQUEST sent
: debug1: SSH2_MSG_SERVICE_ACCEPT received
: debug1: Authentications that can continue: publickey,gssapi-with-mic,password
: debug1: Next authentication method: publickey
: debug1: Trying private key: /c/Users/ibm/.ssh/identity
: debug1: Trying private key: /c/Users/ibm/.ssh/id_rsa
: debug1: read PEM private key done: type RSA
: debug1: Remote: Forced command: gitosis-serve young_ssh
: debug1: Remote: Port forwarding disabled.
: debug1: Remote: X11 forwarding disabled.
: debug1: Remote: Agent forwarding disabled.
: debug1: Remote: Pty allocation disabled.
: debug1: Authentication succeeded (publickey).
: debug1: channel 0: new [client-session]
: debug1: Entering interactive session.
: debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
: ERROR:gitosis.serve.main:Need SSH_ORIhGINAL_COMMAND in environment.
: debug1: channel 0: free: client-session, nchannels 1
: Connection to [马赛克_服务器的IP] closed.
: debug1: Transferred: stdin 0, stdout 0, stderr 38 bytes in 0.6 seconds
: debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 62.3
: debug1: Exit status 1
:
: ibm@IBM-THINK c:/Users/ibm/Documents/git/ec (master)
: $ git remote show origin
: * remote origin
: Fetch URL: ssh://git@[马赛克_服务器的IP]/ec
: Push URL: ssh://git@[马赛克_服务器的IP]/ec
: HEAD branch: master
: Remote branch:
: master new (next fetch will store in remotes/origin)
: Local ref configured for 'git push':
: master pushes to master (up to date)


*** 总结

Convert young.ppk (created by PuTTYGen) as OpenSSH Key;
Copy it into .ssh directory under home directory (of windows ) ;
Name it as id_rsa;
In bash, ssh -v git@[马赛克_服务器的IP];

config中的remote被 git pull 忽略了,使用了ssh。
原因不明。可能是安装git时,选择SSH客户端一步,我选择了PuTTY(plink.exe)。当时的屏幕说明中提到,"PuTTY has
better integration with Windows."

脚本的最终版本

echo ------------------------
echo ec
cd ec
git pull ec master
cd ..

echo ------------------------
echo gitadmin/gitosis-admin
cd gitadmin/gitosis-admin
git pull origin master
cd ../..

echo ------------------------
echo gittest
cd gittest
git pull gittest master
cd ..

echo ------------------------
echo movie
cd movie
git pull movie master
cd ..

echo ------------------------
echo patent_monkeyking
cd patent_monkeyking
git pull patent_monkeyking master
cd ..

echo ------------------------
echo spr
cd spr
git pull spr master
cd ..

echo ------------------------
echo story9000s
cd story9000s
git pull story9000s master
cd ..

echo ------------------------
echo uv
cd uv
git pull uv master
cd ..

echo web程序设计_网络课程
cd web程序设计_网络课程
git pull web_programming_cai master
cd ..

echo ------------------------
echo 马赛克人名.自动调节曝光时间和电压时间
cd 马赛克人名.自动调节曝光时间和电压时间
git pull monkeyking_code master
cd ..

No comments: