I have successfully deployed Integrity on Heroku. I have been able to build script for public repo on git and the build runs successfully.
But running integrity for private repo gives me error as
error: The requested URL returned error: 401\nerror: The requested URL returned error: 401\nerror: The requested URL returned error: 401\n"
"error: pathspec 'origin/master' did not match any file(s) known to git.\n"
I am using the https version for cloning since heroku does not ssh cloning.
I think that for cloning private repo we need to provide password, so is there any way in Integrity to provide a password?
Or is there any other way for the same.
Firstly, you need to uncheck the "Public project" checkbox in Integrity project setting.
Secondly, you need to pass the password on the https url.
And that should work as it works for me :)
Related
I'm currently using Jenkins on Windows 10, and using git as version control system.
Although I provided correct repository URL and credential, I cannot use jenkins with error below.
Failed to connect to repository : Command "git.exe ls-remote -h REPOSITORY_URL HEAD" returned status code 128:
stdout:
stderr: git#URL: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Credential and URL doesn't seems wrong, since this build success previously with same credential. The only change after successful build was one line in build script.
git config --global core.sshCommand C:/Windows/System32/OpenSSH/ssh.exe
After I success with this script, git setting keeps failed. Is there any problem with that line? And how can I fix it?
EDIT
Problem solved! For anyone who has same problem, it was problem with the system user! Since ssh key stores in each user space, jenkins cannot detect where the ssh key located. Therefore, go to 'service' in windows, and change user of jenkins service to the user who has correct ssh key. It solved my problem!
Seems there is some problem in Jenkins.
It cannot locate OpenSSH folder in System32, and so that I cannot get log with it.
That would explain why the main Jenkins controller (aka "master" in old terminology) cannot contact the Git repository (assuming an SSH URL here, with technical remote user account "git")
Try and remove that git configuration to see if the error persists: Git should fall back to its own ssh.exe, packaged with Git For Windows.
As noted by the OP, this only works if said Jenkins is run as a user account, not as the system account.
Only then will it be able to access the %USERPROFILE%\.ssh folder.
I have this error.
remote: Permission to Karthik-B-06/react-starter.git denied to ArunTE.
fatal: unable to access 'https://github.com/Karthik-B-06/react-starter.git/': The requested URL returned error: 403
A 403 error ("Forbidden") likely means that you're not "allowed" to access the repository, likely because you aren't giving the correct credentials (you say you're trying to push to the repository; IIRC that does require credentials to do). Try some of the solutions in this other StackOverflow answer, providing your username and password, and see if they work.
I have installed SCM-Manager. I would like to use it in the future for version control. The problem is, I cannot add it as a repository in Xcode, and I cannot clone it from command line:
$ git clone http://127.0.0.1:8080/scm/git/MyRepo
Cloning into 'MyRepo'...
Checking connectivity... done.
warning: remote HEAD refers to nonexistent ref, unable to checkout.
$
In Xcode I get this message:
fatal: unable to access 'http://127.0.0.1:8080/scm/git/MyRepo/': The requested URL returned error: 403
SCM server logs this
failed to read basic auth credentials
I have tried to install on different server, checkout with different user, nothing helped.
The first message means that you have cloned an empty repository. The message is only a warning and the repository is fully functional. A better way is to create the "bare" repository in SCM-Manager and add the remote reference to a local created repository:
git init MyRepo
git-remote add origin http://127.0.0.1:8080/scm/git/MyRepo/
The messages from Xcode sounds like missing credentials.
I have a private repo that I'm trying to access when deploying to Heroku. However, Heroku doesn't let me clone the private repo, and gives me the following error (as i would expect):
Host key verification failed.
fatal: The remote end hung up unexpectedly
Git error: command `git clone
'git#github.com:pr/lm-models.git'
"/tmp/build_3r0z0znww0zda/vendor/bundle/ruby/1.9.1/cache/bundler/git/lm-models-aab025aaadbe07202b16e1db7505ae1726f8723a"
--bare --no-hardlinks` in directory /tmp/build_3r0z0znww0zda has failed.
!
! Failed to install gems via Bundler.
!
! Heroku push rejected, failed to compile Ruby/rails app
I have found this, but do not want to display my username/password in clear text:
Linking heroku app to a private(organization) github repo
This worked for me:
Generate a Github Access Token
In requirements.txt list private module as follows:
git+https://your_user_name:your_git_token#github.com/your_company/your_module.git
Heroku only supports HTTP(S) Basic authentication with Git out of the box. That's unfortunate as it means you'd need to add your credentials as part of the installation URL and commit that as plain text in your list of dependencies. For your app to support SSH keys instead, do the following:
Create a new SSH key which will be used by Heroku to access the GitHub repository. Choose a distinct name, e.g. id_rsa_heroku.
Add the public part of the key to your GitHub account (link to settings).
Use the heroku-buildpack-ssh-key: heroku buildpacks:add https://github.com/heroku/heroku-buildpack-ssh-key.git -i 1
Set the private part of the key as an environment variable for your Heroku app: heroku config:set BUILDPACK_SSH_KEY=$(cat ~/.ssh/id_rsa_heroku)
From this moment, Heroku should be able to access and download code from any private repositories you have access to.
You need to use username/password in the Gemfile, or vendor the dependency. You can also use Gemfury (assuming it's a gem):
https://devcenter.heroku.com/articles/git-submodules#vendoring
http://gembundler.com/v1.3/bundle_package.html
https://devcenter.heroku.com/articles/gemfury
My Git version is 1.8.0, for this version, the Git installation path in Jenkins is C:\Git\cmd\git.exe (in older versions, it is C:\Git\cmd\git.cmd). This solves the problem that I had: error deleting workspace. In Jenkins, Git repository URL uses the ssh protocol: git#github.com:xxxxx/xxx.git, for me, this URL works. If your key can't be found, this URL will return an error, you need to define %HOME%, then your key should be in %HOME%.ssh. then I started to build. When I built it, I got:
stdout: Cloning into 'C:\Jenkins\workspace\Lily'...
stderr: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
at hudson.plugins.git.GitAPI.launchCommandIn(GitAPI.java:897)
at hudson.plugins.git.GitAPI.access$000(GitAPI.java:42)
I don't understand why Jenkins can find my key for the repository URL, but can't find my key when it clones the repository.
Any help will be greatly appreciated.
My company has a proxy server, for me, to use SSH protocol is very difficult, it may have a way to solve the combination of a proxy server and ssh-to-github, but I gave up. In stead, I used https protocol. In order not to prompt credentials for Jenkins, I used github credential cache to solve this. Check here for credential cache: http://www.kernel.org/pub/software/scm/git/docs/git-credential-cache.html. Now my Jenkins/Git build works in Windows.