问题
I have a project with version.2 and i have to start working on it to develop a new version.3 . I want to create a new repo on a remote server (i.e. a mercurial-server) so that my team member could access that repo .I have my project file on my local machine .
I have two concerned questions :
How can I create it in
/home/hg/repositories/private/project3
(Lets say new repo name would be project3) of remote mercurial-server with my project files. What steps should I follow to do this.How can I create a access permission (usrname/pword) so that my team will access this repo on http://dev.myproject.com/private/project3 .
Note: /home/hg/repositories/
is default for http://dev.myproject.com/ and I have no repo of version 2 (clone is not possible I guess! )
回答1:
Without installing additional server side software your team will need ssh accounts on that box. I'm assuming you have one and that you can create them for your friends. If you don't have that setup you're better off just using bitbucket, which is free and provides both ssh and ftp access.
Also, you don't say if you project2 is already under Mercurial control, so I'm assuming it's not.
To create the remote repo you'd do something like this on your local machine:
hg init project3 # <-- creates a new empty respository
cp ALL_THE_PROJECT3_FILES_YOU_WANT project3 # <--- put the files you want into project3
cd project3 # <-- go into your local project3 repository
hg addremove # <-- LOCALLY add the files you copied in
hg commit -m "initial commit copied in project2" # <-- LOCALLY commit the files
cd .. # <---- go up a directory
hg clone project3 ssh://yourusername@dev.myproject.com//home/hg/repos/project3 # clone the repo over to the server
Your teammates can then clone down using:
hg clone ssh://theirusername@dev.myproject.com//home/hg/repos/project3
Here are some things you could accidentally mess up on the way to getting this working:
- Your friends need ssh accounts
- your friends accounts need read/write access to
/home/hg/repos
Notice that all cloning is happening over ssh. Setting up HTTP is harder and probably not something you need to do.
Seriously, just use bitbucket.
来源:https://stackoverflow.com/questions/11668065/creating-new-remote-repository-for-existing-project-with-mercurial