如何使用 Mercurial 提交 Sourceforge
我有一个名为“Proyectos”的目录,里面有 Django 代码。
我需要将项目提交给 Source Forge,以便我的老师可以将所有代码“下载”到他的计算机上。
我想我应该使用其中一些地址:
http://phone-apps-djan.hg.sourceforge.net:8000/hgroot/phone-apps-djan/phone-apps-djan (read-only)
ssh://[email protected]/hgroot/phone-apps-djan/phone-apps-djan (read/write)
我在 Kubuntu 上这样做了:
lucas@lucas-Satellite-L305:~/Desarrollo/Python/Django/Proyectos$ hg clone http://phone-apps-djan.hg.sourceforge.net:8000/hgroot/phone-apps-djan/django-mercurial
但只创建了文件夹。
我是新手,没有找到如何做到这一点。我遵循了一些教程,但我无法理解很多概念。
请提供一些帮助,我将不胜感激。
提前致谢。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您有两个不同的地址来访问 sourceforge 上的 Mercurial 存储库:
http://phone-apps-djan.hg.sourceforge.net:8000/hgroot/phone-apps-djan/phone-apps-djan(读- only)
,就像地址后面所说的,这个是只读的,它是供每个人克隆你的项目的,这样他们就可以看到源代码并编译/使用它。没有认证啊当您使用此地址时,Mercurial 使用 HTTP 协议来提取更改。ssh://[电子邮件受保护]/h格鲁特/电话- apps-djan/phone-apps-djan(读/写)
,您可以通过此地址写入您的存储库,但您必须验证自己的身份(您必须输入密码)并且 Mercurial 使用 SSH协议来做到这一点。您还可以在地址中看到您的 sourceforge 用户名。首先,您必须使用第二个地址再次克隆您的项目,否则您将无法提交。只需在新目录中
cd
并执行以下操作:系统会提示您输入 sourceforge 帐户密码。
然后,您可以在新创建的目录中 cd 进行所有更改、添加文件等。完成后,您可以执行
hg commit
,然后执行hg Push 将修改发布到您的存储库。如果您向目录添加新文件,请不要忘记执行
hg add
或hg addremove
。你可以在 Hg Init 上找到一个关于 Mercurial 的非常好的和简单的教程,你应该先阅读它并尝试理解工作流程在 Sourceforge 上做任何事情。
祝你的项目好运:)
You have two different address to access your Mercurial repository on sourceforge :
http://phone-apps-djan.hg.sourceforge.net:8000/hgroot/phone-apps-djan/phone-apps-djan (read-only)
, like said after the address, this one is read-only, it is for everyone to clone your project, so they can see the sources and compile / use it. There's no authentication. When you use this address, Mercurial use the HTTP protocol to pull the changes.ssh://[email protected]/hgroot/phone-apps-djan/phone-apps-djan (read/write)
, you can write to your repository through this address, but you have to authenticate yourself (you'll have to enter your password) and Mercurial use the SSH protocol to do that. You can also see your sourceforge username in the address.First of all, you must do another clone of your project with the second address, otherwise you won't be able to commit. Just
cd
in a new directory and do :You should be prompted for your sourceforge account password.
Then, you can cd in the newly created directory, do all your changes, add files, etc. When you're done, you can do a
hg commit
and then ahg push
to publish the modification to your repository. If you add new file to the directory don't forget to do ahg add
orhg addremove
.You can find a really good and simple tutorial about mercurial on Hg Init, you should read it and try to understand the workflow before doing anything on sourceforge.
Good luck with your project :)
非常感谢 Rob Sobers 和 Krtek 的回答。我终于可以将所有文件添加到 SourceForge 中。我按照他们的指示进行,一切都很顺利,尽管我遇到了一些小并发症。
这是我的问题的逐步答案:
在文件夹“Proyectos”上,我做了:
hg clone ssh://[电子邮件受保护]/hgroot/phone-apps-djan/phone-apps-djan
并输入我的 SourceForge 帐户的密码。创建了文件夹“phone-apps-djan”。hg add
在我cd
进入phone-apps-djan
并将项目的所有文件复制到该文件夹中之后。hg 提交
。此时出现错误:中止:未提供用户名(请参阅“hg help config”)
。因此,我在我的主目录中创建了一个名为.hgrc
的文件,并添加了以下几行:<前><代码>[ui]
username = 我在 sourceforce 的用户名 <我注册时提供的邮件地址>;
详细 = 真
然后我重新输入
hg commit
。hg 推送
。显示以下错误消息:abort:未找到存储库默认推送!
。然后我重新编辑了上一步创建的 .hgrc 文件并添加:<前><代码>[路径]
默认 = ssh://[电子邮件受保护]/hgroot/phone-apps-djan/phone-apps-dja
我真的不明白这里发生了什么,因为我的存储库中的
.hg
目录已经包含hgrc< /code> 具有该路径的文件:(。无论如何,我再次执行了
hg push
。仅此而已。
Many thanks to Rob Sobers and Krtek for their answers. I finally could add all my files to SourceForge. I followed their instructions and everything went fine, although I had some minor complications.
This is the answer to my questions step by step:
Over the folder "Proyectos" I did:
hg clone ssh://[email protected]/hgroot/phone-apps-djan/phone-apps-djan
and entered the password for my SourceForge account. A folder "phone-apps-djan" was created.hg add
after Icd
intophone-apps-djan
and copied all the files of my project into that folder.hg commit
. There was an error at this point:abort: no username supplied (see "hg help config")
. So I created a file named.hgrc
in my home dir and added these lines:Then I re-entered
hg commit
.hg push
. The follow error message was displayed:abort: repository default-push not found!
. Then I just re-edited the .hgrc file created on the last step and added:I really don't understand what happened here because the
.hg
directory in my repo already contains ahgrc
file with that path :(. Anyway, I didhg push
again.And that was all.
执行
hg clone
将存储库下载到您的计算机上。现在,要更新您的工作目录(以便您可以使用文件),请输入hg update
。完成更改后,输入
hg commit
进行记录。当您准备好将更改上传到 SourceForge 时,请输入hg push http://path/to/repo。确保您推送到正确的存储库!
Doing
hg clone
downloaded the repository to your computer. Now, to update your working directory (so you can work with the files), typehg update
.When you're done making changes, type
hg commit
to record them. When you're ready upload your changes to SourceForge, typehg push http://path/to/repo
. Make sure you push up to the correct repository!