I have a server with ssh, that I want to use as a central repo. However I can not install mercurial on it. Therefore how can clients push to the server over ssh without having mercurial installed on the server.
Thank You
You do not have to install mercurial on that server. if you can mount it then you can create a regular repository by providing the path to "hg init" for creating a repository on this remote server.
Another way is sshfs. This is a filesystem client based on the SSH File Transfer Protocol.
http://fuse.sourceforge.net/sshfs.html
So using this you could do
sshfs hostname: mountpoint # mounts the file system
hg init mountpoint # do your mercurial operation
fusermount -u mountpoint # unmounts the file system
I have not done this but you could give a try.
Be aware that you can probably install mercurial on the server even if you think you can't. If you have a system with a similar architecture you can make local to install mercurial right in its own distribution directory and then just scp that up to the server.
The only difference in this case is that if you can't get the resulting you#there:mercurialCopiedIn/hg into the $PATH then you'll need to use the --remotecmd argument on your pushes and pulls to say what binary to use.
If the local system can mount the remote repository using sshfs then that would work. Otherwise you're out of luck. :-(
Related
My hg repository is on a server that I can reach with ssh and sftp.
So I can mount the remote dir on my desktop (debian) and can edit the file there.
Now I would like to use Tortoisehg, but I would rather not to clone the repo locally, but just using the remote one that is now mounted locally.
How can I do th?
Now I would like to use Tortoisehg, but I would rather not to clone the repo locally, but just using the remote
It's, in common, The Bad Idea (tm) to use repository from network drive, but:
use this repo the same way, as you edited files in working dir of repository
* Mount to any point of local FS
* Add repository to TortoiseHG Workbench, using "translated" local path to repository
* Use repository as any other really local
But clone|push way is more natural and bullet-proof (no chances to get corrupted repo, real backup of your local repository on remote host)
I can successfully access repositories over http:// using hgweb.cgi:
$ hg clone http://mydomain.com/scgi-bin/hgweb.cgi/myrepo
I can also successfully ssh into mydomain.com using a password.
$ ssh myname#mydomain.com
myname#mydomain.com's password: xxxxxx
Last login: Sat Jun 9 .....
myname#mydomain.com [~]# ls public_html/scgi-bin
./ ../ hgweb.cgi*, hgweb.config
However I can't deduce how to serve repositories via SSH. For example, this doesn't work:
$ hg clone ssh://myname#mydomain.com/public_html/scgi-bin/hgweb.cgi/myrepo
myname#mydomain.com's password: xxxxx
remote: stdin: is not a tty
remote: bash: hg: command not found
abort: no suitable response from remote hg!
I'm concluding that unlike http://, ssh:// doesn't know how to run the cgi script, would that be correct? Is there a solution to this?
(btw: this is on shared hosting, where http's root is public_html/, ssh's root is one directory up.)
HTTP is not the same as SSH. HTTP is a stateless, request-based transmission protocol. SSH is a protocol which establishes a permanent, stateful connection between two machines.
Your HTTP URL looks like a full path to a repository, but it goes through a web server, which is executing the hgweb.cgi script, passing it myrepo as an argument. The hgweb.cgi script runs Mercurial on the server against the myrepo repository (it pulls the actual location from a config file on the server). The command chain looks like this:
Local Mercurial -> HTTP -> Web Server -> hgweb.cgi > Server Mercurial
The SSH URL you're using in the second example tells Mercurial to log into the mydomain.com server as myname, and it can find the repository at /public_html/scgi-bin/hgweb.cgi/myrepo. Most likely, that isn't where your repo is at. The command chain looks like this:
Local Mercurial -> SSH -> Server file system
You need to change your SSH URL to use the absolute path to the repo on the server:
hg clone ssh://myname#mydomain.com/path/to/myrepo
It also looks like the server can't find the Mercurial executable.
Upon using hg's 'verbose' option, two problems were revealed:
When called over ssh, hg automatically tries to run the hg server, hence no need to go via hgweb.cgi.
The path for the hg command (which was set in .bash_profile) didn't get used for non-interactive SSH commands. I had to put the path to hg somewhere that was, such as .bashrc.
Fixing all that up, the following command worked as expected:
hg clone ssh://myname#mydomain.com/public_html/myrepo
I connect repository in projects settings: set repository type as mercurial and set root directory as "/repositories/hg_test" and when i click Repository tab in project i get "The entry or revision was not found in the repository"
Repository separately works great, i can push and pull.
I try to drop tables "changes" and "changesets" in redmine database and do
ruby script/runner "Repository.fetch_changesets" -e production
I get some records in this tables again. Records from my 'hg_test' repository. I think this mean that redmine SEE that repository but cant DISPLAY it.
Why he cant, how to solve this problem? Maybe i must configure something in redmine.
PS OS - Ubuntu 10.04, webserver - nginx with passenger
If your repositories' directory is mounted via SSHFS, be sure to enable -o allow_other when mounting.
Redmine must have permissions to access to your repository. Add webserver's user (in my case it was www-data) in the group ownership of files and directories of repository.
this solution worked for me:
edit (copy *.yml.example if not created yet) file /opt/redmine/config/configuration.yml, and change this line with your hg executable path:
scm_mercurial_command: /usr/bin/hg
restart the webserver containing redmine (typically redmine itself or apache)
test
In Git, there is the command
git remote show <remote>
When properly configured, this will show you the status of the remote compared to your local repository, including whether there are pending changes in either. I can't find a similar command in Mercurial. Am I missing something or does it just not exist?
Perhaps hg summary --remote?
To compare local and remote repositories follow these steps:
go to local repo folder (use cd path_to_local_repo)
run "hg outgoing -p path_to_remote_repo" (without quotes)
See GenerateDiffBetweenRepositories
I'm trying to install Mercurial on a server of something, or even a Linux box, and have users in an intranet log in to use as a repo for them.
This is just an academic exercise I'm pursuing out of curiosity. I'll be using VMWare to simulate a lan.
What would be the best OS to host the Mercurial software on? Thanks!
Host Linux and use ssh:// for your transport (the other option is HTTP). With that set up you need to run no full-time server at all and need to do no installation or configuration past that of the mercurial software itself. Each "user" will need its own account on that linux box in in question, and all access controls are provided by the underlying operating system's file permissions.
Other options, including hg-ssh and hgweb are available and descried on the Publishing Repositories wiki page, but for the basic setup you're describing you can just use ssh and there's nothing more to do:
Creating a repository remotely:
$ hg init ssh://user#yourhost//path/to/repo
Cloning:
$ hg clone ssh://user#yourhost//path/to/repo
Pushing:
$ hg push ssh://user#yourhost//path/to/repo
Pulling:
$ hg pull ssh://user#yourhost//path/to/repo
Where `//path/to/repo (notice there are two sets of double slashes) is any path on the "server" system where the user can read and write.