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.
Related
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/
I have some code on bitbucket.org under mercurial version control. Now I want to download the code on my ubuntu machine over ssh. When I use hg clone everything works well. However hg update never updates any files. I'm not even asked for my ssh password. I checked these setting:
ssh -v hg#bitbucket.org
-> looks ok.
hg showconfig
-> path.default = ssh://hg#bitbucket.org/user/myrepo...
Do you have any idea what else to check?
Thanks.
hg update doesn't contact the remote repo, it pulls changes into the working directory from your local repository. That's why you are not being asked for your bitbucket password. Use hg pull to get the changes from the remote repo into your local repo, then hg update, or just use hg pull -u to do both at once.
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.
Found myself quite confused today about this.
I create a blank repository locally(hg init), cloned it to working copy, added some code, commited and pushed it(to local repo obviously).
Now I need to share that repository with others. There is a server that has mercurial on it, how do I clone my repository to a remote one such that other developers can access it and pull/push code from/to it?
You'll want to check out the publishing repositories wiki page to get into web interfaces and access controls, but at it's most basic you can do something like this:
hg clone yourlocalrepo ssh://you#server//home/you/repo
That clones your local repo to a remote location of your choosing. Note that there are two double slashes in that URL.
You can't create a remote repo like that using http://, only ssh://. If all you have is http to hgweb.cgi you can 'hg init' an empty repo on the server and then hg push to it.
If your "official" repositories are served up by an HTTP server, and you want to create a repo in the central location based on a local machine's repo, here's one way. You need admin rights on the central server to do this.
e.g. I'm developing on windows, and my central repository is running on linux and served by lighttpd per the official guide. The server's central repo directory is /var/hg/repos/, owned by the user/group www-data. My local machine's IP is 10.1.10.100, and the repository I want to clone is named foo.
On the local machine, open a command prompt into the repository directory and type hg serve. This runs the local hg web server, which will allow the server to pull from it.
ssh into the central repo server, logging in as a user with sudo rights to www-data.
cd /var/hg/repos
sudo -u www-data hg clone http://10.1.10.100 foo
For those that come later and don't want to bother about the hassles of ssh for pushing changes to a server built to host repos, you can just init on the server, and then push as you do every other repo.
# on server:
cd repos/
mkdir myrepo
cd myrepo
hg init
cd ..
chown -R apache:apache myrepo
cd ..
vim hgweb.config
# change [paths]
[paths]
myrepo = /path/to/myrepo
# on your machine
# make sure you've configured hgrc correctly
[paths]
default = http://server/hg/repos/myrepo
hg push
# ???
# profit
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)!