首先使用git svn clone将原有的svn代码checkout出来
# git svn clone http://xxxxx
然后使用git gc,注意,如果不使用这一步骤,在后面git clone时会出现错误:
[frank@maya2 gittest]$ git clonehttp://xxx/xxx.git
Cloning into experience...
Username:
Password:
error: The requested URL returned error: 401 (curl_result = 22, http_code = 401, sha1 = 58e93da8b4c7d388f9dc87337cf04304266eba18)
error: Unable to find 58e93da8b4c7d388f9dc87337cf04304266eba18 underhttp://xxx/xxx.git
Cannot obtain needed commit 58e93da8b4c7d388f9dc87337cf04304266eba18
while processing commit 113710e1c27c42ca20f6fd9d97f998b2e9a201ca.
error: Fetch failed.
在服务器上设置git repository
# git clone --bare /path/to/mygit.git
# git update-server-info
我使用HTTP WebDAV的方式做为git server,用的Fedora,在/etc/httpd/conf.d/下添加文件
<Location /mygitrepository.git>
DAV on
#
# # Limit write permission to list of valid users.
# <LimitExcept GET PROPFIND OPTIONS REPORT>
# # Require SSL connection for password protection.
# # SSLRequireSSL
#
AuthType Basic
AuthName "Authorization Realm"
AuthUserFile /path/to/passwdfile
Require valid-user
# </LimitExcept>
</Location>
重新启动httpd,然后在客户端使用命令:
# git clone http://xxx/myrepository.git
如果是在防火墙后面,可能会出现这样的错误:
error: inflate: data stream error (incorrect header check)
error: File 113710e1c27c42ca20f6fd9d97f998b2e9a201ca (http://xxx/xxx.git/objects/11/3710e1c27c42ca20f6fd9d97f998b2e9a201ca) corrupt
换成https,出现其它的错误:
Cloning into experience...
error: SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed while accessing https://xxx/xxx.git/info/refs
fatal: HTTP request failed
这个问题不如如何解决?