Server
$ hg --version
Mercurial Distributed SCM (version 2.0.2)
/usr/share/mercurial-server$ cat mercurial_server-1.1.egg-info
Metadata-Version: 1.1
Name: mercurial-server
Version: 1.1
$ cat /etc/mercurial-server/remote-hgrc.d/check.rc
[ui]
debug = true
[hooks]
commit.h1 = echo "executing commit USER:$REMOTE_USER"
precommit.h2 = echo "executing precommit USER:$REMOTE_USER"
pretxncommit.h3 = echo "executing pretxncommit USER:$REMOTE_USER"
pretxnchangegroup.h4 = echo "executing pretxnchangegroup USER:$REMOTE_USER"
local machine
unity#unity:~/hgtst/hgadmin$ vi keys/users/user.m/user.m.pub
unity#unity:~/hgtst/hgadmin$ hg commit -m "Test L"
unity#unity:~/hgtst/hgadmin$ hg push
pushing to ssh://hg#repo/hgadmin
searching for changes
remote: adding changesets
remote: changesets: 1 chunks
remote: add changeset 9cb298911d0c
remote: adding manifests
remote: manifests: 1/1 chunks (100.00%)
remote: adding file changes
remote: adding keys/users/user.m/user.m.pub revisions
remote: files: 1/1 chunks (100.00%)
remote: added 1 changesets with 1 changes to 1 files
remote: calling hook pretxnchangegroup.access: mercurialserver.access.hook
remote: running hook pretxnchangegroup.h4: echo "executing pretxnchangegroup USER:$REMOTE_USER"
remote: executing pretxnchangegroup USER:
remote: updating the branch cache
remote: calling hook changegroup.aaaaa_servelog: mercurialserver.servelog.hook
remote: running hook changegroup.aaaab_update: hg update -C default > /dev/null
remote: running hook changegroup.aaaac_purge: hg purge --all > /dev/null
remote: calling hook changegroup.refreshauth: mercurialserver.refreshauth.hook
unity#unity:~/hgtst/hgadmin$
when I push some changes from local machine to the mercurial-server via ssh pretxnchangegroup hook is executed but no other hook is getting executed.
This is to be expected.
You don't commit at the remote server, you push changes to it.
That's what changegroup is for, which you are using.
To me it seems like everything is working like it should.
Hope this helps, TW
Related
I have a GitHub repo energys_arduino_max485_mqtt_autoconnect_ec400, but I have problem in push the file to this repo
(base) Mac-Pro energys_arduino_max485_mqtt_autoconnect_ec400 % git remote add origin https://github.com/SamuelXiot/energys_arduino_max485_mqtt_autoconnect_ec400.git
error: remote origin already exists.
(base) Mac-Pro energys_arduino_max485_mqtt_autoconnect_ec400 % git branch -M main
(base) Mac-Pro energys_arduino_max485_mqtt_autoconnect_ec400 % git push -u origin main
error: src refspec main does not match any
error: failed to push some refs to 'https://github.com/SamuelXiot/energys_arduino_max485_mqtt_autoconnect_ec400.git.'
(base) Mac-Pro energys_arduino_max485_mqtt_autoconnect_ec400 % git remote remove origin
(base) Mac-Pro energys_arduino_max485_mqtt_autoconnect_ec400 % git remote add origin https://github.com/SamuelXiot/energys_arduino_max485_mqtt_autoconnect_ec400.git
(base) Mac-Pro energys_arduino_max485_mqtt_autoconnect_ec400 % git branch -M main
(base) esp32#Arthurs-Mac-Pro energys_arduino_max485_mqtt_autoconnect_ec400 % git push -u origin main
error: src refspec main does not match any
error: failed to push some refs to 'https://github.com/SamuelXiot/energys_arduino_max485_mqtt_autoconnect_ec400.git'
(base) Mac-Pro energys_arduino_max485_mqtt_autoconnect_ec400 % git push -u origin master
error: src refspec master does not match any
error: failed to push some refs to 'https://github.com/SamuelXiot/energys_arduino_max485_mqtt_autoconnect_ec400.git'
(base) Mac-Pro energys_arduino_max485_mqtt_autoconnect_ec400 % git pull --rebase
remote: Repository not found.
fatal: repository 'https://github.com/SamuelXiot/energys_arduino_max485_mqtt_autoconnect_ec400.git/' not found
(base) Mac-Pro energys_arduino_max485_mqtt_autoconnect_ec400 % git push
error: src refspec refs/heads/main does not match any
error: failed to push some refs to 'https://github.com/SamuelXiot/energys_arduino_max485_mqtt_autoconnect_ec400.git'
why I cannot push to GitHub??
It seems like you're trying to upload all of your code at once to the empty repo you've made on github's site. It also seems you've already run git init
You need to first commit all of your changes with git add . then git commit -m "comment you choose" so that you have something to push. It's possible that you've made a new branch, you don't need a branch in this situation.
git add .
git commit -m "first commit"
git remote add origin https://github.com/user/repo.git
git push
Finally found the solution, I need to update the GitHub account in Mac first.
Need to delete all account credential
$ git credential-osxkeychain erase
host=github.com
protocol=https
> [Press Return]
create a PAT
https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
then update the git login in terminal
(base) -Mac-Pro 485_mqtt_autoconnect % git push origin
Username for 'https://github.com': SamuelXiot
Password for 'https://SamuelXiot#github.com':
Enumerating objects: 18, done.
Counting objects: 100% (18/18), done.
Delta compression using up to 8 threads
Compressing objects: 100% (12/12), done.
Writing objects: 100% (18/18), 3.22 KiB | 1.07 MiB/s, done.
Total 18 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (1/1), done.
To https://github.com/SamuelXiot/485_mqtt_autoconnect.git
[new branch] master -> master
(base) -Mac-Pro 485_mqtt_autoconnect %
then normal again.
thanks all for the help.
In the build of my first public repository https://github.com/yafred/test-push/ I try to modify my second repository https://github.com/yafred/test
1/ I am using the same personal access token with scope repo (GH_TOKEN) that I'm using to deploy releases.
2/ The commands I am executing from the .travis.yml are
language: generic
script:
- git clone https://github.com/yafred/test.git
- cd test
- echo "hello" > test.txt
- git add .
- git -c user.name='travis' -c user.email='travis' commit -m refresh
- git push -f -q https://{$GH_TOKEN}#github.com/yafred/test master
I have tried a few variations in the commands based on my searches but I keep getting an authentication error
0K$ git push -f -q https://{$GH_TOKEN}#github.com/yafred/test master
remote: Invalid username or password.
fatal: Authentication failed for 'https://{[secure]}#github.com/yafred/test/'
Is it at all possible ?
What am I doing wrong ?
I have a post-receive hook to deploy my app in webroot when I push on master branch.
This is my script:
#!/bin/bash
while read oldrev newrev ref
do
if [[ $ref =~ .*/master$ ]];
then
echo "Master ref received. Deploying master branch..."
git --work-tree=/var/www/mywebroot --git-dir=/home/myuser/myrepo checkout -f master
else
echo "Ref $ref successfully received. Doing nothing."
fi
done
The problem is that when I push any commit that deletes any file, the files were removed are not removed in webroot.
You can add (using git clean) just after the git checkout line:
git -work-tree=/var/www/mywebroot --git-dir=/home/myuser/myrepo clean -fd
That will remove untracked files and folders.
I have installed Jenkins ver. 1.653 on OSX 10.11.3 using standard installer and added git plugin. I tried to create job for public project from github and it works. Now I am trying to create job for private repo using username and password but it always fails. This is log:
Started by user anonymous
Building in workspace /Users/Shared/Jenkins/Home/workspace/MyProject
git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
git config remote.origin.url https://github.com/myproject/myproject-android.git # timeout=10
Fetching upstream changes from https://github.com/myproject/myproject-android.git
git --version # timeout=10
using .gitcredentials to set credentials
git config --local credential.username vandzi # timeout=10
git config --local credential.helper store --file=/Users/Shared/Jenkins/tmp/git428140271294555744.credentials # timeout=10
git -c core.askpass=true fetch --tags --progress https://github.com/myproject/myproject-android.git +refs/heads/:refs/remotes/origin/
ERROR: Timeout after 10 minutes
git config --local --remove-section credential # timeout=10
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://github.com/myproject/myproject-android.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:766)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1022)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1053)
at hudson.scm.SCM.checkout(SCM.java:485)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1269)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:607)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
at hudson.model.Run.execute(Run.java:1738)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Caused by: hudson.plugins.git.GitException: Command "git -c core.askpass=true fetch --tags --progress https://github.com/myproject/myproject-android.git +refs/heads/:refs/remotes/origin/" returned status code 143:
stdout:
stderr:
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1719)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1463)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:63)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:314)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:764)
... 11 more
ERROR: null
Finished: FAILURE
Any idea what can be problem?
Also had ERROR: null in the end, for me it was timeout issue. You can increase timeout for cloning and checkout like this:
Go to job configuration and find git section
Add -> Advanced clone behaviours. There you can specify timeout and check 'shallow copy' (which is faster)
Add -> Advanced checkout behaviours. You can set time out for checkout.
This is my code:
$ git clone https://github.com/Perrydu/jekyll-plumbious.git Perrydu.github.com
$ cd Perrydu.github.com
$ git remote set-url origin git#github.com:Perrydu/Perrydu.github.com.git
$ git push origin master
The terminal:
Last login: Sat Oct 6 19:54:15 on ttys000
Dus-MacBook-Pro:~ Perry$ $ git clone https://github.com/Perrydu/jekyll-plumbious.git Perrydu.github.com
-bash: $: command not found
Dus-MacBook-Pro:~ Perry$ git clone https://github.com/Perrydu/jekyll-plumbious.git Perrydu.github.com
Cloning into Perrydu.github.com...
remote: Counting objects: 34, done.
remote: Compressing objects: 100% (26/26), done.
remote: Total 34 (delta 3), reused 30 (delta 3)
Unpacking objects: 100% (34/34), done.
Dus-MacBook-Pro:~ Perry$ cd Perrydu.github.com
Dus-MacBook-Pro:Perrydu.github.com Perry$ git remote set-url origin git#github.com:Perrydu/Perrydu.github.com.git
Dus-MacBook-Pro:Perrydu.github.com Perry$ git push origin master
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly
Dus-MacBook-Pro:Perrydu.github.com Perry$
jekyll-plumbious.git is my project like jekyll-bootstrap.
I assume that you're following the steps described here:
http://jekyllbootstrap.com/
It looks from your GitHub account as if the problem is that you've created a repository with the name perrydu.github.com, but the repository you're referring to with the URL of origin is Perrydu.github.com. The names of GitHub repositories are case sensitive, so I would go into the GitHub admin interface for the lowercase-named repository (perrydu.github.com) and rename it to Perrydu.github.com.
Then, after a couple of minutes, the push command you tried before should work.