Github enterprise webhook - localhost not recheable over Internet error - github

After upgrading githubEnterprise from 2.19.4 to 3.0.25 one issue appeared.
When I try to create git webhooks with POST request from my local instance or from my CI machine I receive response from git:
{"message":"Validation Failed","errors":[{"resource":"Hook","code":"custom","message":"Sorry, the URL host localhost is not supported because it isn't reachable over the public Internet"}],"documentation_url":"https://docs.github.com/enterprise/3.0/rest/reference/repos#create-a-repository-webhook"}
I know the root cause - creating webhook with localhost callback, but I would like to keep it as it worked before.
I've tried to find some setting/property to set in the config to force github instance to accept that url but I haven't found anything.
Do you know how to tell github to accept this callback urls or any workaround?I don't want to change my tests and CI. I want to configure github that way.
P.S. I've found POST with explanation this behaviour but there is no solution.

Related

RStudio/Git trouble pushing

Hello I am running RStudio 2022.07.1+554 "Spotted Wakerobin" Release (7872775ebddc40635780ca1ed238934c3345c5de, 2022-07-22) for macOS and I can not push to GitHUb.
I have tried to change from HTTPS to SSH but nothing worked so far, I have all the identifications but I do not how to solve it, please could you please help me. I am lost
I want to push projects to GitHub, I have tried many times change from HTTPS to SSH and a new key , also I have verify the connection to ssh and everything seems to work.
Any help is really appreciated.
One option is to stick with HTTPS URL, and use:
credentials::set_github_pat("my_pat")
(Use your Personal Access Token)
That should be enough to allow you to push from RStudio.

Typicode My json server shows "404 error Oops, can't find db.json file on main or master branch. Try to create one and retry."

I had configured JSON server and created a db.json file and even added in some data, everything worked fine so I pushed it to Github, I replaced my localhost JSON server port URL with the one of typicode i.e https://my-json-server.typicode.com/myGithubUsername/myRepository/resource and tested again, still, things worked but after changing my GitHub repository to private am now getting this when I try to access the resource!
404 error Oops, can't find db.json file in myGithubUsername/myRepository/resource on main or master branch. Try to create one and retry.
I changed my GitHub repository back to public and it solved the
problem but this was for my employees so it shouldn't remain public, I
don't know if anyone has a better way to fix this, but this worked!

Github - Failed to clone/remote sync or clone or any github activity

I have github on Windows-7. The github doesn't seem to allow me to check in code as something is messed up.
I did try changing the credentials & so forth by looking up online but nothing seems to work.
I still see the Bad credentials error alongside some wamp developer errors.
I don't know how wamp developer is related to GitHub.
I did have WAMP developer once upon a time on the PC.
The log file for the attempt is here: Github log file.
The error:
2016-03-22 12:44:50.7329|
ERROR|thread: 5|StartupLogging| MISSING PATH!!: 'C:\WampDeveloper\Components\Apache\bin'
That simply means your %PATH% currently reference one non-existent path: you could clean-up your environment variable PATH which is currently quite large.
This is not-blocking for GitHub Desktop though.
The other error is linked to a key previously used for:
Logged user r... off of host 'https://<server_url>'
When that key "C:\Users\ffgr.ghjk\.ssh\github_rsa" is used to authenticate to github.com does not work.
Make sure that key (the public one github_rsa.pub) is added to your GitHub account: "Adding a new SSH key to your GitHub account"

Setting up GitHub webhook with Jenkins on EC2

I have read through almost all of the guides by now on how to set up Jenkins with GitHub, but none of them seem to solve my problem. My job currently builds fine, but I want it to build every time I push to GitHub. I also want to manually set up my hook URLs (not let Jenkins auto-manage them). Currently my Jenkins server is running on EC2 on port 8080 (http://ec2-XX-XXX-XXX-XXX.compute-1.amazonaws.com:8080/). The sys admin says the server is set up to listen to all incoming requests on that port.
Under the GitHub Web Hook area of the Configure System area, I have Manually manage hook URLs checked off.
In my project's configuration, I have the following setup:
GitHub Project: https://github.com/username/projectname/
Source Code Management > Git
Repository URL: git#github.com:username/projectname.git
Branches to Build - Branch Specifier (blank for default): master
Build Triggers > Build when a change is pushed to GitHub
In the GitHub Hook Log it displays the message:
Last GitHub Push
Polling has not run yet.
I have also created a user with which GitHub can connect. The user has a role with the following global permissions:
Overall: Read
Job: Read
Job: Discover
Job: Build
On GitHub, in Settings > Service Hooks I have added https://USERNAME:PASSWORD#ec2-XX-XXX-XXX-XXX.compute-1.amazonaws.com:8080/github-webhook/, where USERNAME and PASSWORD are the username and password for the GitHub account. I added the link to BOTH the WebHook URLs area and the Jenkins (GitHub plugin) area. When I click Test Hook under former area no message of confirmation shows up on the GitHub page, but when I click Test Hook under the latter it says Payload Deployed. Both, however, are registering in my System log file, and they are generating similar errors:
winstone.WinstoneException: Error URI Line: <Garbled Text Here>
at winstone.HttpListener.parseURILine(HttpListener.java:349)
at winstone.HttpListener.parseURI(HttpListener.java:258)
at winstone.RequestHandlerThread.run(RequestHandlerThread.java:83)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:679)
Jun 7, 2013 6:16:31 PM winstone.Logger logInternal
SEVERE: Error within request handler thread
Any ideas about what could be causing this?
If this does not appear in Winstone’s access log, and the problem persists without SSL, try nc -l -p 8080 to see what the actual request being sent from GitHub is. (Or try a different servlet container.)

How to push to a local remote?

I'm having a hard time pushing my commits to a remote repository with libgit2sharp. Using the git bash it works fine.
The remote is addressed via UNC like "//computer_name/remote.git". So it's a folder on a machine in the local network which has an accessible folder.
Cloning it to a local repo with libgit2sharp worked just fine and constructing a remote was successful too with
Remote remote = localrepo.Network.Remotes["origin"];
Now when I try pushing to the remote with:
localrepo.Network.Push(remote, "HEAD", "origin");
I get the exception in git_push_add_refspec() in Proxy.cs
An error was raised by libgit2. Category = Invalid (Error).
Not a valid reference 'origin'
So then I tried:
repo.Network.Push(remote, "HEAD", #"refs/remotes/origin/master");
and got the exception in git_push_finish() in Proxy.cs
An error was raised by libgit2. Category = Net (Error).
Remote transport doesn't support push.
Is there a right way to do this or is there a support problem for my usecase?
Thanks in advance!
[UPDATE]
Now my command looks like this
repo.Network.Push(remote, "HEAD", #"refs/remote/origin/master", pushStErrHnd, null);
The PushStatusErrorHandler has only one line of code in which it should write the PushErrorStatus to console. But console remains blank and then the above exception occurs.
[UPDATE 2]
The static variable Repository.Version was 0.9.5 when I experienced the above.
As nulltoken has already mentioned, local push has just recently been added. You will need to make sure that you have a recent LibGit2Sharp build (you will need LibGit2Sharp containing commit 547a6bd, committed on March 12)
Also, there is a slight mistake in the API usage. The destination reference should be the reference to update on the remote (e.g. #"refs/remote/origin/master" should probably be #"refs/heads/master").
Push to a local repository has been recently added to libgit2 (see PR #1406) and eventually embedded in LibGit2Sharp. However, this feature hasn't been properly tested yet.
In order to try and help you, could you please update your questions with the answers to the few questions below:
Push accept an additional parameter to give more information about issues: onPushStatusError. Could you please provide the output of each potential PushStatusErrors?
You state "Cloning it to a local repo worked". How did you perform the clone? Through git? Through LibGit2Sharp?
What happens if you change the url of the remote to a file URI format (eg. file://computer_name/remote.git)?
UPDATE
The amazing #yorah is working on a Pull Request to enhance the test coverage regarding your scenario.
Cloning from a local repository
Adding a new Commit
Pushing the newly created commit
Retrieving the list of the remote references