"abort: no suitable response from remote hg!" - mercurial

I've just created a new Mercurial repo on my private server, but I can't push to it, and I can't figure out why.
Here's what I see:
% hg push
pushing to ssh://hg#mydomain.com//var/repos/myrepo
abort: no suitable response from remote hg!
On the server, the repo exists, and I can clone it locally:
root#mydomain:/tmp# hg clone /var/repos/myrepo repoclone
updating to branch default
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
I created the repo with hg init myrepo. It's owned by hg:hg, mod 755.
My workstation and server are both running
Mercurial Distributed SCM (version 4.4.1)
What else might be wrong?

Discovered you can add --debug to hg push.
% hg --debug push
pushing to ssh://hg#mydomain.com//var/repos/myrepo
running ssh 'hg#mydomain.com' 'hg -R /var/repos/myrepo serve --stdio'
sending hello command
sending between command
remote: This account is currently not available.
abort: no suitable response from remote hg!
I guess the server user must have a shell.
nano /etc/passwd
Changed
hg:x:999:1002:Mercurial repo owner:/home/hg:/usr/sbin/nologin
to
hg:x:999:1002:Mercurial repo owner:/home/hg:/bin/bash
And now it pushes!

Related

Mercurial and BitBucket, "abort: repository default-push not found!" error message

I've some code on my laptop I would like to upload through Mercurial on my BitBucket repository.
I'm using a Linux CentOS 6 machine.
The problem is that if I type $hg push, I get the following error message:
pushing to default-push
abort: repository default-push not found!
What should I do?
Thanks
Mercurial doesn't know where you want to push to. Mercurial first looks for the destination in the push command (which could be either a repo on the filesystem, or a remote hg server):
hg push remoterepo
If it doesn't find a destination in the command, it will fall back on the defaults.
Normally, assuming this repository was cloned, the hgrc file (in .hg/) will indicate the default repository to be used.
However this assumes that the repository was created by cloning an existing repo.
If not, you can edit .hg\hgrc and add the default destination eg:
[paths]
default-push=http://yourserver/

Hudson - Can't Poll Mercurial

I have Hudson 2.1.2 (not Jenkins) and I've set my projects up to poll my Mercurial repository hourly to check for changes. I generated a public key for my hudson user and added it to the authorized keys on my Mercurial server. When doing the hourly poll, sometimes some projects can't poll Mercurial. Here's an example of what I see in the Mercurial Polling Log:
Started on Apr 30, 2012 2:00:30 PM
[workspace] $ /usr/bin/hg incoming --style /opt/home/hudson/jobs/MyProject/workspace/tmp7506244240405638202style --no-merges --rev default --newest-first
remote: ssh_exchange_identification: Connection closed by remote host
abort: no suitable response from remote hg!
Done. Took 5.3 sec
No changes
However, if I click on "Build Now", it sucessfully polls, picks up changes and builds.
Started by user sdoca
Cleaning the workspace because project is configured to clean the workspace before each build.
$ /usr/bin/hg clone --rev default ssh://hudson#my.mercurial.server:22//opt/hg/current/MyProject /opt/home/hudson/jobs/MyProject/workspace
requesting all changes
adding changesets
adding manifests
adding file changes
added 31 changesets with 40 changes to 11 files
updating working directory
5 files updated, 0 files merged, 0 files removed, 0 files unresolved
[workspace] $ /usr/bin/hg log --rev . --template {node}
[INFO] Using bundled Maven 3 installation
[INFO] Checking Maven 3 installation environment
...
<snip>
Any ideas why I get an error on the auto poll?

how to setup a local repo of mercurial

here is the complete scenario:
Main repository: http://10.0.1.8:8000/ptest
I clone it at host 10.1.0.115, in the folder /LOCAL-REPO
Then, publish it using the command hg serve -p 9900 -d --webdir-conf hgwebconfig with the hgwebconfig file having
[paths]
ptest = /LOCAL_REPO/ptest
[web]
style = gitweb
now, on the same host 10.0.1.115, i create a seperate folder /QA and do:
hg clone http://10.0.1.115:9900/ptest
and get all the files, now i want to make changes and push them to the repo on
http://10.0.1.115:9900/ptest using the command
hg push ssh://10.0.1.115//??/ptest
I don't know what the correct value would be for ??. So the questions are:
How do i setup a user/password to push changes to this repo on 10.0.1.115?
what is the corect syntax in this case?
When I try to push the changes I get error:
hg push ssh://user#10.0.1.115/ptest
user#10.0.1.115's password:
remote: abort: There is no Mercurial repository here (.hg not found)!
abort: no suitable response from remote hg!
Do you really need to push via ssh:// when you pulled via http:// ?
After hg clone http://10.0.1.115:9900/ptest clone you should be able to push it via http as well, like hg push http://10.0.1.115:9900/ptest
But if you really need to push via ssh here it is: you must have your repository accessible under local account, e.g. if user is hg and it's homedir is /home/hg and you will have your repo in /home/hg/repository directory then you will be able to access it via command:
hg push ssh://hg#10.0.1.115/repository/
User/password will be same as to ssh onto user hg.

Cloning a Mercurial repository over SSH

I'm having some difficulty cloning my mercurial repository over ssh.
Here's what I have tried:
hg clone ssh://username#username.webfactional.com/path/to/projectname projectname
It's giving me this error:
remote: bash: hg: command not found
abort: no suitable response from remote hg!
hg is installed on the server, however.
I was trying to follow the instructions on this website.
You need a double // after hostname i.e.:
hg clone ssh://username#username.webfactional.com//path/to/projectname projectname
Sounds like hg is not on your path. The Mercurial FAQ mentions possible fixes for this issue: FAQ/CommonProblems.
Add the remotecmd value to your Mercurial configuration by opening ~/.hgrc (or Mercurial.ini on Windows) on your client machine and adding the following:
[ui]
remotecmd = /path/to/hg
where /path/to/hg is the path to the hg command on the remote server.
If you're having problems with your Mercurial configuration, you can use the hg showconfig --debug command to obtain a full list of your Mercurial settings along with the path and line number of the configuration file that defines each configuration value.
Looks like mercurial isn't in your user's PATH on the remote server.
On webfactional I had to add:
export PATH=$PATH:/home/<user>/bin
to .bashrc to get it to work.
(also followed the remotecmd advice above)
You can use Sourcetree, TortoiseHg, Mercurial from the terminal, or any client you like to clone your Mercurial repository. These instructions show you how to clone your repository using Mercurial from the terminal.
From the repository, click + in the global sidebar and select Clone
this repository under Get to work.
Copy the clone command (either the SSH format or the HTTPS).
If you are using the SSH protocol, ensure your public key is in Bitbucket and loaded on the local system to which you are cloning.
From a terminal window, change to the local directory where you want to clone your repository.
Paste the command you copied from Bitbucket, for example:
CLONE OVER HTTPS:
$ hg clone https://username#bitbucket.org/teamsinspace/hg-documentation-tests
CLONE OVER SSH:
$ hg clone ssh://hg#bitbucket.org/teamsinspace/hg-documentation-tests
If the clone was successful, a new sub-directory appears on your local drive.
This directory has the same name as the Bitbucket repository that you cloned.
The clone contains the files and metadata that Mercurial requires to maintain the changes you make to the source files.
On the server, type: nano ~/.bashrc end edit the file by adding:
# User specific aliases and functions
export PATH=$PATH:$HOME/packages/mercurial
Under the assumption that ~/packages is the folder where mercurial was installed.
After editing, finish off with source ~/.bashrc and try again.
Pretty helpful to me was the following elaborate guide to install mercurial on a Bluehost hosting server.

Can not clone mercurial (hg) repository via http

I can't clone my repository via http:
abort: 'http://MYREPO' does not appear to be an hg repository!
Firstly, I created a new repo by hg init MYREPO followed by adding some file and commit.
The dir with my repo is password protected but there is no sign of problem because of it, I tried both methods of cloning:
(on my local machine)
hg clone http://MYREPO my_repo
and
hg clone http://user:password#MYREPO my_repo
Permissions of repo dir are: drwxrwxr-x
I can clone this very repository on my remote machine (the same repo is on) without any problems.
What could be possibly wrong?
UPDATE:
Looks like you're getting confusing between repository and hostname
If running "hg serve", "hg clone http://USER#HOST:8000" where host can be you machine's IP or the hostname (type "hostname" on linux or try "ping localhost"). You can change the default port from 8000 by passing a --port #### to hg serve.
If you want to do it over ssh, "hg clone ssh://USER#HOST//PATH/TO/YOUR/REPOSITORY". Suppose you made an repository in your home directory called MYREPO then you would do this: "hg clone ssh://USER#HOST/~/MYREPO"
You can only clone your repo via http is something is serving that repo over http. Mercurial provides a built in http server for you. Run "hg serve" while inside of your repo then attempt to clone it from another location (or another command shell). If you just want a local clone, you don't need to use http ("hg clone ").
Also, try "hg help clone" and "hg help serve" for details.
weirdly, cloning with ssh requires a non-intuitive extra forward slash.
this works for me on a host with ssh running on port 43211
hg clone ssh://example.com:43211//repos/myRepo ./myRepo
the double slash after the port number works, but a single slash there results in the ".hg not found" error
besszero is right, but why don't you clone using SSH if you are gonna use username and password anyway?
hg clone ssh://machine_ip//your/repo/location your_repo
It's also safer if you don't want to open another port for mercurial's http server and you don't need the hgweb features, the traffic is also encrypted. The only con is that you have to log in to checkout, but HTTP doesn't work for pushing back the changes, at least not in my experience.
Argh... One need to be careful with .htaccess configuration. In my case I needed to add 'hgwebdir.cgi' to the path to clone... Thanks for the answers though!
SSH seems logical but somehow I couldn't use it with user other than my local:
hg clone ssh://MY_REMOTE_USER#MYREPO
remote: abort: There is no Mercurial repository here (.hg not found)!