fabric8 -how to deploy deploy with gitk keys and create new projects in google cloud - fabric8

I am working in google cloud with kubernetes and deployed the cluster like in the examples
i downloaded gofabric8-0.4.42-darwin-amd64.tar.gz and deploy it and i am running into a few issues:
i cant create new projects -> The last operation resulted in the following error: Unauthorized with no errors in the log
link to question :
fabric8 -The last operation resulted in the following error: Unauthorized
how can i deploy fabric8 with ssh key to my git ?
note:i am working with gitlab
LOGS:
Error occurred during error handling, give up!
org.apache.cxf.interceptor.Fault: Failed to command remote repo git#:backend/bash-parser.git due: ssh://git#:22: org.eclipse.jgit.transport.CredentialItem$YesNoType:The authenticity of host '' can't be established.
RSA key fingerprint is 46:24:24:04:ca:83:62:33:0c:c0:85:4e:21:ea:4d:fa.
Are you sure you want to continue connecting?
at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162)[cxf-core-3.1.6.jar:3.1.6]
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:128)[cxf-core-3.1.6.jar:3.1.6]
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:189)[cxf-rt-frontend-jaxrs-3.1.6.jar:3.1.6]
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:99)[cxf-rt-frontend-jaxrs-3.1.6.jar:3.1.6]
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)[cxf-core-3.1.6.jar:3.1.6]
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)[cxf-core-3.1.6.jar:3.1.6]
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)[cxf-core-3.1.6.jar:3.1.6]
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)[cxf-core-3.1.6.jar:3.1.6]
at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:254)[cxf-rt-transports-http-3.1.6.jar:3.1.6]
at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)[cxf-rt-transports-http-3.1.6.jar:3.1.6]
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)[cxf-rt-transports-http-3.1.6.jar:3.1.6]
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)[cxf-rt-transports-http-3.1.6.jar:3.1.6]
at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:180)[cxf-rt-transports-http-3.1.6.jar:3.1.6]
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:298)[cxf-rt-transports-http-3.1.6.jar:3.1.6]
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:217)[cxf-rt-transports-http-3.1.6.jar:3.1.6]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)[servlet-api-3.1.jar:3.1.0]
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:273)[cxf-rt-transports-http-3.1.6.jar:3.1.6]
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:837)[jetty-servlet-9.3.10.v20160621.jar:9.3.10.v20160621]
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:583)[jetty-servlet-9.3.10.v20160621.jar:9.3.10.v20160621]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)[jetty-server-9.3.10.v20160621.jar:9.3.10.v20160621]
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)[jetty-security-9.3.10.v20160621.jar:9.3.10.v20160621]
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)[jetty-server-9.3.10.v20160621.jar:9.3.10.v20160621]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)[jetty-server-9.3.10.v20160621.jar:9.3.10.v20160621]
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)[jetty-servlet-9.3.10.v20160621.jar:9.3.10.v20160621]
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)[jetty-server-9.3.10.v20160621.jar:9.3.10.v20160621]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)[jetty-server-9.3.10.v20160621.jar:9.3.10.v20160621]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)[jetty-server-9.3.10.v20160621.jar:9.3.10.v20160621]
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)[jetty-server-9.3.10.v20160621.jar:9.3.10.v20160621]
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119)[jetty-server-9.3.10.v20160621.jar:9.3.10.v20160621]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)[jetty-server-9.3.10.v20160621.jar:9.3.10.v20160621]
at org.eclipse.jetty.server.Server.handle(Server.java:524)[jetty-server-9.3.10.v20160621.jar:9.3.10.v20160621]
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:319)[jetty-server-9.3.10.v20160621.jar:9.3.10.v20160621]
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:253)[jetty-server-9.3.10.v20160621.jar:9.3.10.v20160621]
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)[jetty-io-9.3.10.v20160621.jar:9.3.10.v20160621]
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)[jetty-io-9.3.10.v20160621.jar:9.3.10.v20160621]
at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)[jetty-io-9.3.10.v20160621.jar:9.3.10.v20160621]
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)[jetty-util-9.3.10.v20160621.jar:9.3.10.v20160621]
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)[jetty-util-9.3.10.v20160621.jar:9.3.10.v20160621]
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)[jetty-util-9.3.10.v20160621.jar:9.3.10.v20160621]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)[jetty-util-9.3.10.v20160621.jar:9.3.10.v20160621]
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)[jetty-util-9.3.10.v20160621.jar:9.3.10.v20160621]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_91]

See the separate question for where we can answer that one
To import a project from your own git repository you will need to create a Secret in your users namespace (e.g. in the user-secrets-source-admin namespace) to contain your SSH key, user/password or github user and token.
Then when you import the project (via Team -> Team Dashboard -> Create Application -> Import from Git) after you've supplied the git URL you can select the Secret you wish to use with your git repository so that the git repository can be cloned & edited.
Its a little easier to use HTTPS URLS with git repository as you can then just use user/passwords - or better - use user name + tokens from (say) github. But if you use a ssh based URL for a git repo then you'll have to import your public + private keys into the Secret.

Related

Connecting TortoiseGit to github using different SSH credentials per repo

I have several repos on github, and two different accounts. My accounts are the creators of both repos which are discussed below (username1 created repo1 and username2 created repo2).
How do I configure tortoisegit to set which credentials (putty key) to use when connecting to each github repo?
On Tortoisegit > settings > Git > Remote, I have repo1 configured as:
Remote: origin
URL: git#github.com:username1/MyRepo1.git
Push URL: (blank)
Putty Key: path/to/account1.ppk
And repo1 configured as:
Remote: origin
URL: https://github.com/username2/myRepo2.git
Push URL: (blank)
Putty Key: path/to/account2.ppk
However, when I try to push to the first repo, I get the error:
git.exe push --progress "origin" master:master
ERROR: Permission to username1/MyRepo1.git denied to username2. <-- why is username2 showing up here?!?
fatal: Could not read from remote repository.
... why is it trying to use username2 (which is not configured anywhere on repo1) to connect? And where can I configure which username to use when connecting?
I tried changing the settings in Tortoisegit > settings > Git, to set Name: username1 and Email: user1#mydomain.com but it didn't make any difference (got the same error message when trying to push).
I've tried to follow the explanations on the accepted answer of TortoiseGit - Multiple GitHub repositories with different key pairs each , however, I cannot work out what to do for any of them...
Use PuTTY sessions as described in ...
Well... the instructions on both links are too general to be useful. There's no concrete example to work with.
Use OpenSSH...
It basically says "change to 'ssh'... but that just creates new problems. How do I configure OpenSSH to make the connection? Or tell it which credentials to use for which repo? Again... no concrete examples.
Use https with...
If I change the connection for repo1 to https://github.com/username1/MyRepo1.git then I get the error fatal: unable to access 'https://github.com/username1/MyRepo1.git/': The requested URL returned error: 403
So I changed it to https://username1#github.com/username1/MyRepo1.git and then I got a pop-up asking me to log into github. I did that as a last resort and it (seems to have) worked, however, I want to use the ssh keys, not login based auth.
So... back to the question: how do I configure TortoiseGit to use different SSH credentials to connect to different repos?
And, for bonus points... can I configure a default set of credentials for TortoiseGit to use and then just over-ride those on a repo-by-repo basis when something different is needed? If so, how? (I ask because this seems to be what is happening unintentionally, so I wonder if there's a way to intentionally use it as a feature!)
Thank you for reading, and thanks in advance for helping!
how do I configure TortoiseGit to use different SSH credentials to connect to different repos?
First, use SSH URLS for both repositories.
Since repo2 is configured with https://github.com/username2/myRepo2.git, the SSH key is simply ignored.
And that is why Tortoise mentioned username2
You need git#github.com:username2/myRepo2.git if you want your associated SSH key to be used at all.

Google Cloud Build: Clone Private Repository on google Cloud Repository failing

We are testing Google Cloud Repositories with Google Cloud Build.
We created a basic cloudbuild.yaml and the build itself is started (we are using Go).
Our Go Programm has some imports that are in the same repository (which is hosted on Google Cloud Repositories) e.g:
src/repository
main.go (has import source.developers.com/repository/subpackage)
subpackage/
in the package itself we have the import path over source.developers.google.com.
When Go attempts to clone the repository (when running go get, it fails due to missing credentials:
Step #0: Cloning into '/workspace/gopath/src/source.developers.google.com/ourrepository'...
Step #0: fatal: could not read Username for
'https://source.developers.google.com': terminal prompts disabled
Step #0: package source.developers.google.com/subpackage: exit status 128
[...]
ERROR: build step 0 "gcr.io/cloud-builders/go" failed: exit status 1
The cloud build account already has access to the repository and is allowed to clone it.
How can we clone the repository with Google Build?
Just go to Cloud source repository and select "clone" at the top right, then pick an authentication method, the easiest is "Google cloud SDK" the copy the command and run it in yout command line
I think you need to make a docker container that has git in it(ubuntu container) and in that container you clone your repository using ssh keys, after you have linked your container with code repository. Then you push that conyainer onto gcr in your project. Next, in your cloudbuild.yaml you use that very container you pushed, to clone the repo via ssh url.

gcloud init fails for invalid username/password

I am trying to gain access to the embedded git repository for an existing Google Developers Console (GDC) project. The GDC shows the git repository under -SOURCE CODE-Releases. I followed the official gcloud installation instructions to the point:
gcloud auth login /* pulls up browser and does authentication just fine */
gcloud config set project <project>
gcloud init <project>
The latter always results in the following (replacing actual project name with 'fishbone'):
$gcloud init fishbone
Initialized gcloud directory in [/Users/dummy/Workspace/fishbone/.gcloud].
Cloning [https://source.developers.google.com/p/fishbone/r/default] into [default].
Initialized empty Git repository in /Users/dummy/Workspace/fishbone/default/.git/
fatal: remote error: Invalid username/password.
You may need to use your OAuth token password; Note that generated google.com passwords are not compatible with private repositories
ERROR: Unable to initialize project [fishbone], cleaning up [/Users/dummy/Workspace/fishbone].
ERROR: (gcloud.init) Could not fetch repository.
Only on the very first installation of the SDK (re-tried more than once now), I remember gcloud init asking for a username. Never again after this. Mac OS X 10.9.3 and:
$git --version
$git version 1.8.5.2 (Apple Git-48)
I am aware of this related gcloud init issue, but it's not this. Help greatly appreciated.
Go to https://console.developers.google.com/project/your-project-id > Source Code > Browse > Find this line : "Alternatively, instead of using the Google Cloud SDK to manage your authentication, you can manually generate your Git credentials by following this link." > Click "following this link" and you can see your git password. As you can see in your error, google password are not compatible with private repositories. Now you can :
Use your gmail and git password above to clone reposite.
Or create .netrc file at your home folder and add : "machine source.developers.google.com login your-email#gmail.com password 1/abxxxxxxxxxxxxxxxxxxxxxxx" to this file. It will not request your password again.
Just goto your Google Developer Console and click /
find the content like below
"Alternatively, instead of using the Google Cloud SDK to manage your authentication, you can manually generate your Git credentials by following this link."
and click "following this link" then follow the instructions on that page.
Thats all.
They moved the options to manually created Git credentials. The options are now under GCP -> (tools) Development -> Source Code
and under the options when cloning new or existing repos they give you the option to use gcloud or create your own credentials.
also below in screenshots

Gitlab - Xcode Can't connect with remote repository

I am having troubles when I connect with my repository through Xcode.
I have a Gitlab version (full pre-)installed on TurnkeyLinux Virtual Appliance on a remote server.
In the Gitlab Web interface, I've created a new test user: "testuser" with a password "password" and a new project "testproject". This user was assigned to this project.
The git url project are:
HTTP: http://example.com/testuser/testproject.git
SSH: git#example.com:testuser/testproject.git
I can see the repositories folder rightly created with a "Terminal" through SSH connection.
Now, I want add this git repository to my Xcode repositories.
So, In
XCode > Preferences > Account
I'm trying add it, using both urls and my user credentials, but always receive the following message:
"Authentication failed because the name or password was incorrect."
Could anyone help me?
The user/password would only be needed for an http url, not an ssh one.
When using the http url to add a repo in your XCode Accounts, make sure there is no proxy which would prevent the resolution of the example.com server.
If it is still not working, then, as in "Authentification issue when pushing Xcode project to GitHub", try to use an url like:
https://testuser:password#example.com/testuser/testproject.git
Even if the problems seems solved I've found this question when I had the problem using XCode 10.
I tried logging in to GitHub and got the same error. The workaround described didn't fix my problem but I've found another solution on my own which I'd like to share – maybe it helps somebody ;)
My GitHub password included an 'ä' character (I'm German) and seems XCode and GitHub don't support the used encoding. After changing my password to something without an 'ä' it worked fine. Maybe it wasn't because of the 'ä' but it already helped to change the password - I don't know.
Thank you, but the reasons are Xcode seems a little crazy…
In
Xcode > Source Control > Test Project (master) > Configure Test Project…
I've just added my repository HTTP URL and credentials were not needed, and when I trying push/pull actions Xcode ask me for user/password.
Seems to be Repository in Preferences > Account doesn't work fine…
you'd better use the project configuration:
‘Source Control’ > ’(project name)-Master’ > ‘Configure (project name)’,
select ‘Remote’, choose ‘+’ > Add Remote
Name : origin
Address : git#gitlab.com:xxx/yyy.git
(Curiously it appears after this in the XCode prefs)
Don't forget: using SSH, the password is the one you used (keygen) when building the key !
I don't want to use HTTP! Key file under "git" user is very convenient and secure, I'm not going to type my password in a unencrypted URL entry in some plist file.
In my case, the problem was that Xcode was trying to use the wrong key file : .ssh/id_rsa instead of .ssh/id_dsa
Here using Xcode 7.3.1 and finally managed to push using ssh (and Gogs as github server) by doing so:
1) select the correct private key (there must also be the public key file present)
on Gogs side:
2) add that same key from the Gogs user Settings->SSH Keys
3) under admin panel: Dashboard: Operations: rewrite the authorised_keys file
Done

Tower can't connect to git (permission denied) when certificate has different name

I can't connect to to GitHub repo from Tower (Mac OS X), getting permission denied error. I suppose this is caused by different certificate name (github_rsa not id_rsa). I added identity to ssh and from Terminal everything is working correctly. Any suggestions?
If you mention that everything work from the terminal, then you have the correct public/private keys, and you have published your public key on GitHub.
However, Tower won't always use, at first, ssh when connecting to GitHub, which means you also need to enter your GitHub login and token:
See Tower: Creating a repository on GitHub, and GitHub: Set your user name, email and GitHub token.
The configuration dialog box for Tower creating a repo on GitHub uses those credentials instead of ssh keys:
After that, is will use an ssh connection for cloning.

Resources