svn 仓库设置
我正在尝试在 FreeBSD 系统上为我的课程项目设置一个存储库。代码在~/OSI中,然后我输入以下命令:
% svnadmin create ///home/SVN/repo
% svn co file:///home/SVN/repo
% cd ~/OSI
% chmod -R u+w include
% svn add include
然后出现错误“.”不是工作副本。我必须先将 ~/OSI 导入到 /home/SVN/repo 吗?
I'm trying to set up a repository on a FreeBSD system for my course project. The code is in ~/OSI, then I typed the following commands:
% svnadmin create ///home/SVN/repo
% svn co file:///home/SVN/repo
% cd ~/OSI
% chmod -R u+w include
% svn add include
Then an error "." is not a working copy. Do I have to import ~/OSI to /home/SVN/repo first?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您对 Subversion 存储库目录和工作目录之间的差异感到完全困惑。我教授 Subversion 很长时间了,这是最常见的事情。您不能使用 Subversion 存储库作为工作目录。您必须重新开始,因为您可能已经损坏了存储库结构。
一次一步。
$HOME
下的目录中。因此,首先您需要创建一个存储库。为此,您可以使用 svnadmin 命令。该命令对存储库进行操作。该命令是:
请注意,该命令中没有 URL。事实上,
svnadmin
从不采用 URL,只采用位于本地计算机上的物理文件。svnlook
命令也是如此。这些在服务器上运行。在你的情况下,你想要这样做:前面只需要一个斜线。这是一个目录的名称。您也可以这样做:
甚至可以这样做:
我强烈建议您使用 svnserve 作为您的 Subversion 存储库服务器。这使得输入 URL 变得更加容易。另外,它还有助于将您与存储库位置分开。初学者会发现它不那么令人困惑。
为此,您需要执行两件事:
首先,编辑 svnserve.conf 文件。您需要修改两行:
将有两行(在我的文件版本中为 11 和 12)如下所示:
删除前面的
#
。事实上,这是默认的,所以这并不重要。如果这是您的个人存储库,您可以将anon-access
更改为write
。这样,您就不需要登录。我个人都保持原样。第 20 行周围是这样的:
再次删除该行前面的
#
。就是这样。保存此文件。现在,在同一目录中,编辑
passwd
文件。在[Users]
行下输入如下内容:david
是您的用户 ID。我建议您将其设置为与您的 Unix ID 相同的 ID。swordfish
是密码。随心所欲地做吧。如果您希望其他人能够访问此存储库,只需将它们放在这里,每行一个用户,格式与您的用户名和密码相同。保存passwd
文件。您永远不必再接触这些文件。现在,我们将启动
svnserve
。每当您重新启动系统时都需要执行此操作。您甚至可能想将启动脚本放在 /etc/init.d 目录下:(一个小细节...确保运行 svnserve 的用户拥有该目录以及
下的所有文件>/home/SVN/repo
否则,svnserve
命令将无法读取/写入所需的文件,因为您正在您的目录下执行所有这些操作。 用户 ID,应该没问题)。就是这样,现在您可以转到其他地方并创建一个工作目录。在您的主目录下执行此操作。假装
/home/SVN/repo
根本不存在。在此过程中,它可能会要求您输入密码。只需输入您在
passwd
文件中使用的相同密码即可。您刚刚所做的是创建您的第一个提交。您创建了三个基本目录trunk
、branches
和tags
。你需要这样做吗?没有。请注意,您的目录位于
~/my_workdir
中,而不是位于/home/SVN/repo
中。请注意,因为我使用的是 svnserve,所以我什至没有提及该目录。/home/SVN/repo
是服务器的目录。你别碰!正如我所说,作为客户,很有可能您甚至不知道它位于哪里。现在,你的进口:
哇!没有
svn import
?不,我们有一个工作目录 (~/my_workdir
),所以我们可以简单地添加文件。 Subversion svn add 命令将递归添加 OSI 目录以及所有文件和子目录。您可以运行 svn status 命令并验证是否已添加所有文件。现在,您所要做的就是提交更改:
请注意,我仅需要
svn://localhost
命令用于svn co
命令。我的工作目录已经知道从中签出的 URL。您可以运行 svn info 并查看该信息。现在,试试这个:
我们已经完全删除了您刚刚所做的所有工作。然而,Subversion 存储库仍然拥有它。让我们再次检查一下:
这将创建一个
OSI
目录,其中包含您导入到 Subversion 存储库中的所有 OSI。这是您的新工作目录。请注意,我指定了 trunk/OSI。现在,您可以在那里完成所有工作,并提交所有更改。我希望这有助于为您澄清问题。现在,阅读在线Subversion 用户指南。现在您已经完成了此操作,您会发现开始的章节变得更有意义。
You're completely confused by the difference between the Subversion Repository Directory, and your working directory. I've been teaching Subversion for a long time, and this is the most common thing that happens. You cannot use the Subversion repository as your working directory. You'll have to start over because you've probably damaged the repository structure.
One step at a time.
$HOME
.So, first you need to create a repository. You use the
svnadmin
command for that. That command does stuff to the repository. The command is:Notice there's no URL in the command. In fact the
svnadmin
never takes a URL, only a physical file located on the local machine. Same is true with thesvnlook
command. These run on the server. In your case, you want to do this:Only a single slash is needed in the front. This is the name of a directory. You could have also done this:
And maybe even this:
I highly recommend that you use the
svnserve
as your Subversion repository server. This makes it easier to type in URLs. Plus, it helps separate yourself from the repository location. Beginners find it less confusing.To do this, you need to do two things:
First, editing the
svnserve.conf
file. You'll need to modify two lines:There will be two lines (11 and 12 in my version of the file) that look like this:
Remove the
#
from in front. Actually, this is the default, so it really doesn't matter. If this is your personal repo, you can changeanon-access
towrite
. That way, you don't need to log in. I personally keep them both the way they are.Around line #20 is this:
Again, remove the
#
from the front of the line. That's it. Save this file.Now, in the same directory, edit the
passwd
file. Under the[Users]
line put something like this:The
david
is your User ID. I suggest that you make it the same ID as your Unix ID. Theswordfish
is the password. Make it whatever you want. If you want others to be able to access this repository, simply put them in here, one user per line, in the same format as your user name and password. Save thepasswd
file. You'll never have to touch these files again.Now, we'll start the
svnserve
. You'll need to do this whenever you restart your system. You might even want to put a startup script under your /etc/init.d directory:(One little detail... Make sure that the user running
svnserve
owns the directory and all the files under/home/SVN/repo
. Otherwise, thesvnserve
command won't be able to read/write the required files. Since you're doing all of this under your user ID, that should be fine).That's it, now you can go elsewhere and create a working directory. Do this under YOUR HOME directory. Pretend that
/home/SVN/repo
doesn't even exist.Somewhere along the line, it might ask for your password. Just put in the same one you used in the
passwd
file. What you've just done is create your first commit. You created the three base directoriestrunk
,branches
, andtags
. Did you need to do this? Nope.Notice that your in the
~/my_workdir
and not in/home/SVN/repo
. Notice, because I'm usingsvnserve
, I didn't even mention that directory. The/home/SVN/repo
is the Server's directory. You don't touch! As I said, it's very possible -- as a client -- you don't even know where it's located.Now, your import:
Whoa! No
svn import
? Nope, we have a working directory (~/my_workdir
), so we can simply add the files. The Subversionsvn add
command will recursively add in theOSI
directory and all files and sub directories. You can run thesvn status
command and verify that all the files were added.Now, all you have to do is submit your changes:
Notice that I needed the URL
svn://localhost
only for thesvn co
command. My working directory already knows the URL it was checked out from. You can runsvn info
and see that information.Now, try this:
We have completely removed all the work you just did. However, the Subversion repository still has it. Let's check it out again:
This will create an
OSI
directory with all of your OSI you've imported into your Subversion repository right there. This is your new working directory. Notice that I specified trunk/OSI. Now, you can do all of your work there, and commit all of your changes.I hope this helps clarifies things for you. Now, read the on line Subversion User Guide. Now that you've done this, you'll find the beginning chapters making a lot more sense.
是的。请参阅 http://svnbook.red-bean.com/en/ 1.5/svn.tour.importing.html。
Yes. See http://svnbook.red-bean.com/en/1.5/svn.tour.importing.html.
你的问题的答案是“是”,你需要先将 ~/OSI 导入到 /home/SVN/repo 。
将该文件夹导入到 SVN 存储库后,您可以删除 OSI 目录并从存储库中签出新的工作区,然后继续下一步。
The answer to your question is "Yes", you need to import ~/OSI to /home/SVN/repo first.
After you import that folder into SVN repository, then you can blow away your OSI directory and checkout a fresh workspace from the repository and continue with your next step.