{"id":307,"date":"2022-12-24T11:55:33","date_gmt":"2022-12-24T03:55:33","guid":{"rendered":"http:\/\/www.cgh0610.cn\/?p=307"},"modified":"2024-04-16T14:07:42","modified_gmt":"2024-04-16T06:07:42","slug":"307","status":"publish","type":"post","link":"https:\/\/www.cgh0610.cn\/?p=307","title":{"rendered":"\u5b9d\u5854\u5b89\u88c5svn\u5e76\u81ea\u52a8\u53d1\u5e03"},"content":{"rendered":"<ul>\n<li>\u67e5\u770b\u662f\u5426\u5df2\u7ecf\u5b89\u88c5\u4e86svn<\/li>\n<\/ul>\n<p><code>svnserve --version<\/code><\/p>\n<ul>\n<li>\u6ca1\u6709\u5b89\u88c5\u7684\u8bdd\u5b89\u88c5subversion\uff0c\u76f4\u63a5\u7528yum \u5b89\u88c5<\/li>\n<\/ul>\n<p><code>yum install -y subversion<\/code><\/p>\n<ul>\n<li>\u68c0\u6d4b\u662f\u5426\u5b89\u88c5\u6210\u529f<\/li>\n<\/ul>\n<p><code>svn --version<\/code><\/p>\n<ul>\n<li>\u521b\u5efasvn\u76ee\u5f55<\/li>\n<\/ul>\n<p><code>mkdir \/www\/server\/svn<\/code><\/p>\n<ul>\n<li>\u521b\u5efasvn\u914d\u7f6e\u76ee\u5f55<\/li>\n<\/ul>\n<p><code>mkdir \/www\/svnconfig<\/code><\/p>\n<p>\u5206\u522b\u6dfb\u52a04\u4e2a\u6587\u4ef6<\/p>\n<ul>\n<li>add.sh<\/li>\n<\/ul>\n<pre><code class=\"shell\">#!\/bin\/bash\n\necho -e \"\\n\"\n\nread -t 30 -p \"\u8bf7\u8f93\u5165\u4ed3\u5e93\u540d\u79f0:\" NAME\n\necho -e \"\\n\"\n#echo \"\u4ed3\u5e93\u540d\u79f0\u4e3a:<span class=\"katex math inline\">NAME\"\n\n#NAME=oa\n\n\nPATH=\"\/www\/server\/svn\/<\/span>NAME\"\n\nif [ -d \"<span class=\"katex math inline\">PATH\" ];then\n    echo -e<\/span>NAME\"\u4ed3\u5e93\u5df2\u7ecf\u5b58\u5728\\n\"\n    exit 1\nfi\n\n\/usr\/bin\/svnadmin create <span class=\"katex math inline\">PATH\n\n\/bin\/cp \/www\/svnconfig\/svnserve.conf<\/span>PATH\/conf\/\n\n\/bin\/cp \/www\/svnconfig\/post-commit <span class=\"katex math inline\">PATH\/hooks\/\n\necho -e \"export LANG=zh_CN.UTF-8 \\n\\n\/usr\/bin\/svn update \/www\/wwwroot\/<\/span>NAME --username svn --password aseghwiotghoisdhagoih --no-auth-cache \\n\\nchown -R www:www \/www\/wwwroot\/<span class=\"katex math inline\">NAME\">><\/span>PATH\/hooks\/post-commit\n\nif [ -f \"\/www\/wwwroot\/<span class=\"katex math inline\">NAME\/.user.ini\" ];then\n    \/usr\/bin\/chattr -i \/www\/wwwroot\/<\/span>NAME\/.user.ini\nfi\n\n\necho -e \"[\"<span class=\"katex math inline\">NAME\":\/] \\n@itwork=rw \\n*=\\n\\n\">>\/www\/svnconfig\/authz\n\n\/usr\/bin\/svn checkout svn:\/\/127.0.0.1\/<\/span>NAME \/www\/wwwroot\/<span class=\"katex math inline\">NAME --username svn --password aseghwiotghoisdhagoih --no-auth-cache\n\necho -e \"\\n\"\n\n\/bin\/chown -R www:www \/www\/wwwroot\/<\/span>NAME\n\n\necho -e \"\u76ee\u5f55\u521b\u5efa\u6210\u529f\\n\"\n\n\n<\/code><\/pre>\n<ul>\n<li>authz<\/li>\n<\/ul>\n<pre><code class=\"shell\">### This file is an example authorization file for svnserve.\n### Its format is identical to that of mod_authz_svn authorization\n### files.\n### As shown below each section defines authorizations for the path and\n### (optional) repository specified by the section name.\n### The authorizations follow. An authorization line can refer to:\n###  - a single user,\n###  - a group of users defined in a special [groups] section,\n###  - an alias defined in a special [aliases] section,\n###  - all authenticated users, using the '<span class=\"katex math inline\">authenticated' token,\n###  - only anonymous users, using the '<\/span>anonymous' token,\n###  - anyone, using the '*' wildcard.\n###\n### A match can be inverted by prefixing the rule with '~'. Rules can\n### grant read ('r') access, read-write ('rw') access, or no access\n### ('').\n\n[aliases]\n# joe = \/C=XZ\/ST=Dessert\/L=Snake City\/O=Snake Oil, Ltd.\/OU=Research Institute\/CN=Joe Average\n\n[groups]\n# harry_and_sally = harry,sally\n# harry_sally_and_joe = harry,sally,&joe\nitwork = svn,svn2\n\n# [\/foo\/bar]\n# harry = rw\n# &joe = r\n#*=\u65e2\u662f\u6240\u6709\u4eba\u4e3a\u7a7a\u6743\u9650\n# * =\n\n# [repository:\/baz\/fuz]\n# @harry_and_sally = rw\n# * = r\n\n#[www.baidu.com:\/] \n#itwork=rw \n#*=\n\n<\/code><\/pre>\n<ul>\n<li>passwd<\/li>\n<\/ul>\n<pre><code class=\"shell\">### This file is an example password file for svnserve.\n### Its format is similar to that of svnserve.conf. As shown in the\n### example below it contains one section labelled [users].\n### The name and password for each user follow, one account per line.\n\n[users]\n# harry = harryssecret\n# sally = sallyssecret\nsvn = xxxxxxx\nsvn2 = xxxxxxx\n<\/code><\/pre>\n<ul>\n<li>post-commit<\/li>\n<\/ul>\n<pre><code class=\"shell\">#!\/bin\/sh\n\n# POST-COMMIT HOOK\n#\n# The post-commit hook is invoked after a commit.  Subversion runs\n# this hook by invoking a program (script, executable, binary, etc.)\n# named 'post-commit' (for which this file is a template) with the \n# following ordered arguments:\n#\n#   [1] REPOS-PATH   (the path to this repository)\n#   [2] REV          (the number of the revision just committed)\n#\n# The default working directory for the invocation is undefined, so\n# the program should set one explicitly if it cares.\n#\n# Because the commit has already completed and cannot be undone,\n# the exit code of the hook program is ignored.  The hook program\n# can use the 'svnlook' utility to help it examine the\n# newly-committed tree.\n#\n# On a Unix system, the normal procedure is to have 'post-commit'\n# invoke other programs to do the real work, though it may do the\n# work itself too.\n#\n# Note that 'post-commit' must be executable by the user(s) who will\n# invoke it (typically the user httpd runs as), and that user must\n# have filesystem-level permission to access the repository.\n#\n# On a Windows system, you should name the hook program\n# 'post-commit.bat' or 'post-commit.exe',\n# but the basic idea is the same.\n# \n# The hook program typically does not inherit the environment of\n# its parent process.  For example, a common problem is for the\n# PATH environment variable to not be set to its usual value, so\n# that subprograms fail to launch unless invoked via absolute path.\n# If you're having unexpected problems with a hook program, the\n# culprit may be unusual (or missing) environment variables.\n# \n# Here is an example hook script, for a Unix \/bin\/sh interpreter.\n# For more examples and pre-written hooks, see those in\n# the Subversion repository at\n# http:\/\/svn.apache.org\/repos\/asf\/subversion\/trunk\/tools\/hook-scripts\/ and\n# http:\/\/svn.apache.org\/repos\/asf\/subversion\/trunk\/contrib\/hook-scripts\/\n\n\nREPOS=\"<span class=\"katex math inline\">1\"\nREV=\"<\/span>2\"\n\nmailer.py commit \"<span class=\"katex math inline\">REPOS\" \"<\/span>REV\" \/path\/to\/mailer.conf\n\n\n\n\n##WEB=\/www\/wwwroot\/www.baidu.com \n#WEB=\/www\/wwwroot\/\n\n#export LANG=zh_CN.UTF-8\n\n#\/usr\/bin\/svn update <span class=\"katex math inline\">WEB --username svn --password 1111 --no-auth-cache \n\n#chattr -i<\/span>WEB\/.user.ini\n\n#chown -R www:www $WEB\n\n\n\n\n\n\n\n\n<\/code><\/pre>\n<ul>\n<li>svnserve.conf<\/li>\n<\/ul>\n<pre><code class=\"shell\">### This file controls the configuration of the svnserve daemon, if you\n### use it to allow access to this repository.  (If you only allow\n### access through http: and\/or file: URLs, then this file is\n### irrelevant.)\n\n### Visit http:\/\/subversion.apache.org\/ for more information.\n\n[general]\n### The anon-access and auth-access options control access to the\n### repository for unauthenticated (a.k.a. anonymous) users and\n### authenticated users, respectively.\n### Valid values are \"write\", \"read\", and \"none\".\n### Setting the value to \"none\" prohibits both reading and writing;\n### \"read\" allows read-only access, and \"write\" allows complete \n### read\/write access to the repository.\n### The sample settings below are the defaults and specify that anonymous\n### users have read-only access to the repository, while authenticated\n### users have read and write access to the repository.\n# anon-access = read\n# auth-access = write\nanon-access = none\nauth-access = write\n### The password-db option controls the location of the password\n### database file.  Unless you specify a path starting with a \/,\n### the file's location is relative to the directory containing\n### this configuration file.\n### If SASL is enabled (see below), this file will NOT be used.\n### Uncomment the line below to use the default password file.\n# password-db = passwd\npassword-db = \/www\/svnconfig\/passwd\n### The authz-db option controls the location of the authorization\n### rules for path-based access control.  Unless you specify a path\n### starting with a \/, the file's location is relative to the the\n### directory containing this file.  If you don't specify an\n### authz-db, no path-based access control is done.\n### Uncomment the line below to use the default authorization file.\n# authz-db = authz\nauthz-db = \/www\/svnconfig\/authz\n### This option specifies the authentication realm of the repository.\n### If two repositories have the same authentication realm, they should\n### have the same password database, and vice versa.  The default realm\n### is repository's uuid.\n# realm = My First Repository\n### The force-username-case option causes svnserve to case-normalize\n### usernames before comparing them against the authorization rules in the\n### authz-db file configured above.  Valid values are \"upper\" (to upper-\n### case the usernames), \"lower\" (to lowercase the usernames), and\n### \"none\" (to compare usernames as-is without case conversion, which\n### is the default behavior).\n# force-username-case = none\n\n[sasl]\n### This option specifies whether you want to use the Cyrus SASL\n### library for authentication. Default is false.\n### This section will be ignored if svnserve is not built with Cyrus\n### SASL support; to check, run 'svnserve --version' and look for a line\n### reading 'Cyrus SASL authentication is available.'\n# use-sasl = true\n### These options specify the desired strength of the security layer\n### that you want SASL to provide. 0 means no encryption, 1 means\n### integrity-checking only, values larger than 1 are correlated\n### to the effective key length for encryption (e.g. 128 means 128-bit\n### encryption). The values below are the defaults.\n# min-encryption = 0\n# max-encryption = 256\n\n<\/code><\/pre>\n<ul>\n<li>\u542f\u52a8SVN<\/li>\n<\/ul>\n<p><code>svnserve -d -r \/www\/server\/svn<\/code><\/p>\n<ul>\n<li>\u8fdb\u5165svn\u914d\u7f6e\u76ee\u5f55,\u6267\u884cadd.sh<br \/>\n<code>.\/add.sh<\/code><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u67e5\u770b\u662f\u5426\u5df2\u7ecf\u5b89\u88c5\u4e86svn svnserve &#8211;version \u6ca1\u6709\u5b89\u88c5\u7684\u8bdd\u5b89\u88c5subversion\uff0c\u76f4\u63a5\u7528y &hellip; <a href=\"https:\/\/www.cgh0610.cn\/?p=307\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u5b9d\u5854\u5b89\u88c5svn\u5e76\u81ea\u52a8\u53d1\u5e03<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"aside","meta":[],"categories":[70],"tags":[],"_links":{"self":[{"href":"https:\/\/www.cgh0610.cn\/index.php?rest_route=\/wp\/v2\/posts\/307"}],"collection":[{"href":"https:\/\/www.cgh0610.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cgh0610.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cgh0610.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cgh0610.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=307"}],"version-history":[{"count":4,"href":"https:\/\/www.cgh0610.cn\/index.php?rest_route=\/wp\/v2\/posts\/307\/revisions"}],"predecessor-version":[{"id":309,"href":"https:\/\/www.cgh0610.cn\/index.php?rest_route=\/wp\/v2\/posts\/307\/revisions\/309"}],"wp:attachment":[{"href":"https:\/\/www.cgh0610.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=307"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cgh0610.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=307"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cgh0610.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=307"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}