I am trying to set up Jenkins to automatically build when I push to github. My environment is as follows :
1) I code in eclipse on my laptop. (windows)
2) I push from my laptop to http://github.com/myaccount/plugin
3) My jenkins is on a vps. (windows)
Is it possible to do this?
When inputting my repository, I am getting the following error :
Failed to connect to repository : Could not init C:\Windows\TEMP\hudson53570147835241625tmp
I have force polling workspace enabled, and still getting the error.
It is possible.
In jenkins:
define git SCM for your repo URL
in build triggers choose 'Poll SCM' (without scheduling)
In github
go to your repo Settings->WebHooks and Services
define a webhook to post to http://<your_jenkins_server>/git/notifyCommit?url=<your_repo_url>
Now push to your repo and see your build triggered.
Related
I'm trying to integrate Jenkins with a private repository on GitHub.
I have a Multibranch Pipeline job configured with github's SSH URL: git#github.com:user/repo.git. The GitHub plugin is also installed. On GitHub I added the webhook per-plugin documentation.
Now, whenever a change is pushed to the repo Jenkins logs the event, but not start a build.
My best guess is that it happens due to URL mismatch: the job has SSH url, but github seems to send HTTP URL (http://github.com/user/repo). I do not know how to verify or address it.
I have solved my problem by installing the Git Branch Source Plugin and setting up the GitHub source in the configuration.
First check you are able to access git repo from command line like below,
ssh git#github.com:user/repo.git
If it returns "Permanently added the RSA host key for IP address" . Then its fine else check for ssh key added in git.
If above step is correct then proceed to below task
in project url under Github Project in job config give htttp url ( ex : http://github.com/user/repo ).
in repository url under Source Code Management give git url ( ex : git#github.com:user/repo.git ).
For detailed info
https://medium.com/#marc_best/trigger-a-jenkins-build-from-a-github-push-b922468ef1ae
Hey how to connect my webpage with github repository ,I mean , when I merge pull request it immediately make change in my webpage.I was using github-pages but now I would like include some php and it doesn't work. Thanks for any help.
Manual: after each push to the repo you´d have to pull on your server for the current version. (You don´t want this...)
Automation: first you need a server (linux/ windows) with git installed and clone the repository to your webserver directory (i.e. apache.webserver: var/www/html). Then you need a script which automaticly pulls the new changes to your server and use a webhook to trigger the script. That way you´d have the current version of your repo on the server all the time. (Push --> Webhook triggers script --> Server repo get´s new changes)
Alternative: create NOT a github BUT a git repository hosted on your own server (tuturial for linux only). You could push into it aswell and you´d have the current version of your site on the server without the path over github.
I have created a repository on Github. I am using Windows 7 64 bit and Pycharm Community edition. I want to integrate the Github repository with pycharm but I am getting the error
Couldn't get the list of GitHub repositories
Connect to api.github.com:443 [api.github.com/192.30.252.127] failed: connect timed out
Although I am able to clone he same repository from command prompt using git clone command.
I had the same issue.
Configure your proxy if using one:
File->Settings->System Settings->HTTP Proxy
Another thing to try is to clone the project locally then add as new project in Pycharm. Afterwards I was able to do all git operations under VCS->git including add/commit/push for my project.
try to check whether you have given the path to Git executable correctly by testing it using test button next to it...(file>settings>version control>Git>path to Git Executable)
make sure you have given the git client path correctly..
C:\Program Files\Git\cmd\git.exe
So I'm trying to connect to github via netbeans and uploading a project.
The steps I have taken:
right click project - initialize git repository
right-click project - commit
right-click project - remote - push...
When I am in the push menu:
specify git repository location:
git#github.ugent.be:brosseel/oefen2.git
private/public key:
Users/Username/.ssh/id_rsa.pub
NEXT>>
I get:
Error : Cannot connect to the remote repository at git#github.ugent.be:brosseel/oefen2.git
How to troubleshoot that error message?
It should work if your repo exist first on GitHub (and https://github.ugent.be/brosseel/oefen2.git doesn't seem to exist).
You need to initialize an empty repo of that name, and then try to push form NetBeans.
You also can use the https url:
https://github.ugent.be/brosseel/oefen2.git
And put your GitHub username and password.
But again, that supposes you have created a repo of that name on GitHub prior to trying to push to said repo.
What I have done so far:
Deployed a tomcat6.0 server to c:\www
Downloaded and deployed the Hudson.war in the c:\www\webapps folder
Installed the Github plugin
Created a private repository on Github
On the server, with hudson installed, generated ssh keys.
Environment variable %HOME% is set to c:\Documents and settings[username] (there is a .ssh directory in there with the keys)
Environment variable %HUDSON_HOME% set to c:\www\webapps\hudson
In hudson I have the following configurations:
Github Project: https://github.com/[my organization]/[project name]
Source Code Management: Git
URL of Repository: git#github.com:[my organization]/[project name].git
Branch specifier: **
Repository Browser: (Auto)
When I run a build, and click the console output link I see this --
Started by user anonymous
Checkout:workspace / C:\www\webapps\hudson\jobs\[project name] (git)\workspace - hudson.remoting.LocalChannel#2e8f6d20
Using strategy: Default
Checkout:workspace / C:\www\webapps\hudson\jobs\[project name] (git)\workspace - hudson.remoting.LocalChannel#2e8f6d20
Fetching changes from the remote Git repository
Fetching upstream changes from git#github.com:[organization name]/[project name].git
... at which point it hangs. When I cancel the build, the following are added --
ERROR: Problem fetching from origin / origin - could be unavailable. Continuing anyway
ERROR: (Underlying report) : Error performing command: git.exe fetch -t git#github.com:[organization name]/[project name].git +refs/heads/*:refs/remotes/origin/*
null
ERROR: Could not fetch from any repository
FATAL: Could not fetch from any repository
hudson.plugins.git.GitException: Could not fetch from any repository
at hudson.plugins.git.GitSCM$3.invoke(GitSCM.java:796)
at hudson.plugins.git.GitSCM$3.invoke(GitSCM.java:754)
at hudson.FilePath.act(FilePath.java:756)
at hudson.FilePath.act(FilePath.java:738)
at hudson.plugins.git.GitSCM.gerRevisionToBuild(GitSCM.java:754)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:540)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1180)
at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:506)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:422)
at hudson.model.Run.run(Run.java:1362)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:145)
First off, since you are starting off with a new CI instance, I would highly recommend that you install the Jenkins fork instead (since it is actively maintained by most of the original developers of Hudson).
Secondly, install the DumpInfo Wrapper plugin and re-run the build again. This plugin prints the system properties and environmental variables in effect during the build and allows you to verify them.
Update:
That plugin should log the system properties and environmental variables, I am surprised you do not see them. As for the passphrase, I suggest you generate a separate private key (from your existing pair) that is not passphrase-protected instead, otherwise you may need to consider the solution offered for: Why git can't remember my passphrase under Windows. I have verified that it works (when I set up my own CI on windows) but I don't feel it is worth the trouble (there are other nuances including installing and running the tomcat instance as the currently logged in user, and NOT as local service, so that pageant will work with it properly), hence I would recommend the first option.
In my case it turned out to be the problem with Git client: I was using v1.6.0 which was triggering
fatal: https://github.com/dmak/jaxb-xew-plugin.git/info/refs download error - The requested URL returned error: 403
error message in Hudson. First it looked like this issue, but strace analysis of git run shown that is was Nginx WebServer (which GitHub is running on) returning 403, not the proxy.
When I've updated to v1.7.3 the problem was gone. So general advise: don't use old clients with GitHub.
P.S. I have tested the cloning both with "Branch Specifier (blank for default): origin/master" in Hudson job configuration and also with blank (default): in both cases Git was able to discover the master branch (origin/master) correctly and used it for cloning.