I am using SSH to push to the central mercurial repository on the remote server.
I put in a hook so the remote repo will update:
[hooks]
changegroup = hg update >&2
when I try to push to the remote repo, the push succeeds, but I get this output:
remote: added 1 changesets with 1 changes to 1 files
remote: abort: Permission denied: /var/www/sites/businesslicenses/.hgignore
remote: warning: changegroup hook exited with status 255
any ideas for me?? thanks!
If you use SSH and don't setup a dedicated user account on your server, then you will need to ensure that:
the necessary users are in a common group and
newly created files belong to that group
newly created files are group writable
See "The filesystem method" in the wiki for more information. Generally, I find that it's easier to user a dedicated user on the server and then grant people access by adding SSH public keys to .ssh/authorized_keys.
Check if /var/www/sites/businesslicenses/.hgignore is owned by the current user and is not owned by root.
Related
I just set up several repositories on my Ubuntu server. I can pull from them just fine, but when I try:
hg push ssh://myserver//hg/repo
I get
abort: could not lock repository ... Permission denied
This is a permissions issue. The name being used to authenticate must either be the owner of all the files, or be in a group that has write permission to all the files.
Alternatively, you could set the permissions to 777, but that last 7 is a really bad idea, as then anyone who is able to gain any kind of access to the server could play havoc with the repositories.
Hosting Mercurial on a windows box thru IIS.
I have a root directory where I put all of my repos
d:\repos
- ProjectA
- .hg
- hgrc
- ProjectB
- .hg
- hgrc
- ProjectC
- .hg
- hgrc
All of the repos' hgrc files setup the notify extension with:
config =d:\hg\Repositories\NotificationList.txt
That way I have a single file to manage all of the notification recipients, like the wiki describes:
https://www.mercurial-scm.org/wiki/NotifyExtension
But the wiki makes mention of controlling that NotificationList.txt file thru it's own repository? How can I do that? If I create a separate repo at d:\repos\HgNotify and have the NotificationList.txt file in there, users can change, commit and push back, but when the push occurs, NotificationList.txt does not get updated on the hg server.
Is there a way to update that file somehow? Am I missing a key setup on my Hg server? Or do I need to use a post-push hook to deploy that file?
Update 1
I added the details from Tim's answer and I kept getting HTTP 500: Server Error on the push. I finally figure out how to trace the python calls (python -m win32traceutil), and here is what seems to be the problem:
File "C:\Python27\lib\site-packages\mercurial\util.py", line 402, in hgexecutable
exe = findexe('hg') or os.path.basename(sys.argv[0]) AttributeError: 'module' object has no attribute 'argv'
It doesn't seem to be able to find hg.exe.
Update 2
I installed TortoiseHg and rebooted the system. Now I get:
emote: added 1 changesets with 1 changes to 1 files
remote: notify: sending 1 subscribers 1 changes
remote: warning: changegroup.update hook exited with status 1
So that makes be think that it has found the hg.exe, but it is not doing its job, because the file does not get updated
Update 3
Found my solution here: https://stackoverflow.com/a/8023594/698
The command line I ended up using was:
changegroup = cmd /c hg update
I also added:
[ui]
debug=true
To my hgrc. Those two combined gave me a lot more meaningful messages. In the end I saw "Access denied". I gave Users full permission, but I am not sure why giving IUSR full permission didn't work. Something I'll have to dig into at a later time.
On the server repo containing your notification list you need to add a changegroup hook:
[hooks]
changegroup.update = hg update -C
or if you want to ensure the repository is always clean:
[extensions]
purge =
[hooks]
changegroup.update = hg update -C && hg purge --all
I am trying to make a push using mercurial to a repo on Bitbucket. I made sure to copy correctly the ssh key from ~/.ssh/id_rsa.pub to my bitbucket account.
cat .hg/hgrc
[paths]
default = ssh://bitbucket.org/mcarey/arakoon
Still when pushing I got this error:
pushing to ssh://bitbucket.org/mcarey/arakoon
remote: Permission denied (publickey).
abort: no suitable response from remote hg!
I would assume the problem is as the repo shall be
ssh://hg#bitbucket.org/mcarey/arakoon
Is this correct? If so how to modify it? If not, what is it about?
Just edit .hg/hgrc:
[paths]
default = ssh://hg#bitbucket.org/YOURNAME/REPONAME
Ok. important to note the following
hg# before the bitbucket.org/YOURNAME/REPONAME
YOURNAME shall be the name in the repo not the user name. the username is attached in the SSH key or HTTPS username/password.
These were my problems. Its solved now
I'm a git & github user that's new to mercurial & bitbucket and I'm trying to use bitbucket for a project.
So far I've got write access to a new private bitbucket repository, and I got started by:
cloning
adding my existing project
committing
trying push, I get authorization failed via:
HTTPS
$ hg push https://mariusbutuc#bitbucket.org/DB2UAdmin/repo
http authorization required
realm: Bitbucket.org HTTP
user: mariusbutuc
password:
pushing to https://mariusbutuc#bitbucket.org/DB2UAdmin/repo
searching for changes
abort: authorization failed
SSH
$ hg push ssh://hg#bitbucket.org/DB2UAdmin/repo
pushing to ssh://hg#bitbucket.org/DB2UAdmin/repo
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 9664 changes to 9664 files
remote: You're not allowed to write to this repository.
remote: transaction abort!
remote: rollback completed
remote: abort: pretxnchangegroup.bb_perm hook failed
also attempted via simple HTTP, got similar results as with HTTPS.
How can I get it to work?
Extra details:
python 2.7.1+
mercurial 1.7.5
on Ubuntu 11.04
The bitbucket account was opened under my gmail address [addr A].
The SSH key was made using the address from my company [addr B].
addr B was added to my account as a secondary address.
I had writing access for the mariusbutuc account, that had both addresses.
...I still couldn't pass the auth test.
Got an invitation form the Admin, on my work address - addr B. With admin rights, not only write.
Trying to accept the invitation, I couldn't: my account already had access to the repository.
Had to revoke my own access, just to be able to
accept the admin rights.
Pushed successfully via SSH:
$ hg push ssh://hg#bitbucket.org/DB2UAdmin/repo
pushing to ssh://hg#bitbucket.org/DB2UAdmin/repo
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 9664 changes to 9664 files
remote: bb/acl: mariusbutuc is allowed. accepted payload.
I still have no idea why pushing via HTTPS [username/password] failed!
For those of you that arrive here from googling "pretxnchangegroup.bb_perm hook failed" this can be caused by trying to merge to a branch that you do not have the "write" permission under "branch permissions" on bitbucket.
Presumably this is because you should have used a pull request for the merge rather than going ahead and merging on your local.
I've got a mercurial repository, which pulls in dependencies using the subrepository functionality (as defined in the .hgsub file), but I'm struggling to get this working in TeamCity.
I've enabled the mercurial_keyring extension in order to save credentials (so when TeamCity provides authentication details for the root repository, it remembers them for the subrepositories). I've added an [auth] section to mercurial.ini too:
[auth]
bitbucket.schemes = https
bitbucket.prefix = https://bitbucket.org/xyz
bitbucket.username = xyz
If I run hg clone from the command line, I get prompted for a password once, and all is good. But the initial checkout when run via TeamCity fails with
VCS root: mercurial: https://bitbucket.org/xyz/projectA {instance id=23, parent id=1}, due to error: 'cmd /c hg update -C -r 4a08f587bb1f' command failed. stderr: abort: http authorization required stdout: pulling subrepo src\Common.Library from https://bitbucket.org/xyz/common.library
What am I missing, or am I going about this in completely the wrong way? Many thanks!
It seems that passing in credentials directly from TeamCity doesn't work with mercurial_keyring, but if I specify both username and password in plaintext in the mercurial.ini file (making sure it's accessible under the account the TeamCity build agent is running under), then this works.
The mercurial.ini file can be placed under <mercurial install path>\mercurial.ini if it does not work under user path.
Not ideal, but a solution... if anyone else finds a better one, please let me know.
May be it got fixed in last versions of TeamCity, but the following works for me:
Configure build agent service to run under domain account with
access to HG repositories (both root and subrepos)
Enable mercurial_keyring on build agent and add [auth] section
to mercurial config
Try to clone repository manually, enter
password. No need to wait until the whole repo is cloned -- it could
be terminated when "requesting all changes" message is shown.
Have fun -- now service will use keyring.
Probably the [auth] section shouldn't be added at all to the mercurial.ini for the TC agent. Team City uses --config auth... options to hg. I would also recommend not to use the mercurial_keyring but to set the username and password in VCS root - this is both secure and shared between different TC agents.
Not sure about the bitbucket, but in other cases usage of https scheme can require certificates configuration. This can be configured in mercurial.ini:
[web]
cacerts =
[hostfingerprints]
# hides mercurial warnings
domain-name = ab:cd:...:01
And last part: depending on .hgsub it might be needed to use VCS checkout mode "Automatically on agent" in Team City Version Control Settings.