Android studio SSL certificate problem: unable to get local issuer certificate (LONGTERM SOLUTION) - android-studio

I know this is known issue. I am trying to do the git pull in my android studio with current project and I get this warning. So I generated my key on macbook with command:
ssh-keygen -t rsa
than I copy it and added to bitbucket profile in ssh keys. Also I added certificate to the android studio settings (tools -> server certificates).
Still I get this issue. I tried with changing git.config but also without success.
with command:
git config --global http.sslVerify false
it works well, but I don't want solutions like this since it is bad and not secure.
Does anyone has any good suggestion. Thanks!

After long time spent I found the solution. This can be very helpful so try it out if you have same problem.
Situation was that in my android studio I added HTTPS URL (e.g., https://bitbucket.org/username/repo.git) instead of SSH URL (e.g., git#bitbucket.org:username/repo.git). You can change this in Git -> Manage remotes. Copy the SSH URL from bitbucket (or any other VCS by clicking on clone option and selecting ssh instead of https)
So Even though everything is set up well, SSL protocol (used to transfer securely data) is unable to connect (in these situations SSH protocol is used. It allows executing commands, not only sending data like SSL. It is usually used for log in situations like this)
Hope this helps, have a good day coding.

Related

What means terminal prompts disabled?

I use gitlab since some years.
After an update of my mac book, one application fails on deploy with deployer.
fatal: could not read Username for 'http://mygitlab.org:22': terminal prompts disabled
I use the same gitlab server for all projects. The other projects are working well.
I compared the gig config file. No differences between the applications.
I tried to set/change the username. No success
I created a new repo on gitlab, and cloned it into my php storm. No success
Has someone an idea, where i have to search?
Thanks in advance!
Check the URL of that repository. A port 22 is the default one used by SSH, so seeing an HTTP URL used is strange, and would trigger a prompt for the username.
This differs from a git#mygitlab.org: URL (or ssh://git#mygitlab.org:22/...), which should not need any prompt, if the right SSH key is used (and has no passphrase, or if the passphrase is cached in an ssh-agent).

Log in to Github via Fedora Server 37

I am using Mac OS as my main operating system. I installed fedora 37 server edition in a VMware workstation as part of my course in college. I am trying to customize my prompt using this repo https://github.com/andresgongora/synth-shell.
I have installed git already. I also have power line-fonts installed. The issue I am having comes with this command: git clone --recursive https://github.com/andresgongora/synth-shell.git
When typed and executed I get a prompt asking me for a GitHub username and password. I enter my credentials and I get an error stating "Authentication Failed for https://github.com/andresgongora/synth-shell.git" even though my credentials are correct.
I have tried putting my username and password (both combinations separately) and I get an event error. I configured a global username and that doesn't work either.
Am I supposed to log in to my GitHub before cloning this repo? Does anyone else experience this or have a workaround?
I have tried putting my username and password (both combinations separately) and I get an event error. I configured a global git username and that doesn't work either.
Sites used:
Can't clone a github repo on Linux via HTTPS
https://docs.github.com/en/get-started/getting-started-with-git/setting-your-username-in-git
https://documentation.red-gate.com/soco/troubleshooting/authentication-failed-when-cloning-from-github
Edit: I have also tried setting up a token to log in with. The only issue I am having is my linux distro does not support copy and paste so I am having to type everything out. When the password prompt comes up everything is blank to hide your password so I can't even check for spelling errors.
As of mid 2021, github the company is now enforcing git HTTPS authentication to use an access token rather than username+password. See this stackoverflow answer for full information.
One way forward is to generate an SSH key, and upload the public portion to github.
It warrants mentioning that this change is specific to Github Inc., the Microsoft subsidiary. There have not been any changes to git, the distributed version control system. Other, similar repository hosting services may not necessarily bar you from authenticating via username+password. Gitlab is one example.
I managed to fix my issue by using cockpit in my web browser. Doing this allowed my to copy and paste my information and everything worked first try.
Beginner problem.

How to Remove Keys from SourceTree SSH Agent

I am using SourceTree on Windows. I have SSH keys to validate the server connection. So, when I start Sourcetree it launches the SSH Agent which then asks me for the passwords for each key. That is fine.
However, while I can see an option in SourceTree to "Add SSH Key" I cannot see how to remove one. My actual problem is that, due to a misleading error message, I re-added the key and it now has the same key multiple times and asks for too many passwords at start-up! But, more generally, i would like to be able to list and remove keys from the SSH agent.
I have tried using command line ssh-add but it says
Error connecting to agent: No such file or directory
(Tried this both with windows CMD shell and in the Git bash terminal that SourceTree launches)
I see a running ssh-agent.exe process in Task Manager when SourceTree is running - in the Details tab. But in the Services tab it says the service is stopped. So, I guess SourceTree has started it but how do I connect to it? Alternatively, how to tell SourceTree not to start it's own but use the Windows Service?
I am using the OpenSSH SSH client (in SourceTree options)
Finally found my own answer. There doesn't appear to be a way to connect to the agent directly, but the keys are stored directly in the SourceTree config. Tools | Options | General | SSH Client Configuration : SSH Key. This field is a semi-colon separated list of paths to the keys to load. I just removed the duplicates from there.
Now have issues getting SourceTree and OpenSSH Agent to co-exist, but that's a different question. At least it only asks me for each password once.

Intellij Android Studio opens localhost page to login on github

I am using android studio version 4.2 beta 3 and while I am using the GUI to push/fetch the studio prompts to login on github while I have already set an account.
The strange this is that I can use git on terminal but not on GUI.
I select the first option and my browser navigates me to a website that says to authorize in Github, I press the button, login on Github and then I get the following localhost page which needs some unknown credentials.
Do you have any ideas on how to fix this issue?
Thanks
This actually turns out to be an Android Studio bug.
See e.g. this and this reports
In the corresponding IntelliJ IDEA version it is working fine.
Log in using a token instead, as a workaround.
Unfortunately the issue still persists in android studios latest release but your workaround of Token works.
you have to Generate a new SSH key and adding it to the ssh-agent ,
you can find it there
My Github account is using the Single Sign-On from my organisation, so what worked for me was to go into Github settings -> SSH and GPG keys and then clicked on the button Configure SSO on my SSH key. Then click on "Authorize" for your organization.
Here's more details on how to do it https://docs.github.com/en/enterprise-cloud#latest/authentication/authenticating-with-saml-single-sign-on/authorizing-an-ssh-key-for-use-with-saml-single-sign-on
This works when you get the following error while checking your project out
Clone failed
ERROR: The `----' organization has enabled or enforced SAML SSO. To access
this repository, you must use the HTTPS remote with a personal access token
or SSH with an SSH key and passphrase
that has been authorized for this organization. Visit
https://docs.github.com/articles/authenticating-to-a-github-organization-with-saml-single-sign-on/ for more information.
Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

How to store your github https password on Linux in a terminal keychain?

This is becoming even more important now with the new 2-factor authentication, as one has to create a new token each time a password is required on the terminal. Basically, I'm looking for an equvalent to the osxkeychain available in OS X that I could use on Linux desktops and servers:
git config --global credential.helper osxkeychain
I searched through the possible solutions, but so far I don't like any of them:
ssh instead of https - not recommended and links not easily accessible on GitHub
cache --timeout=3600 - it will expire eventually and reentering the password is a drag with the new 2FA
gnome-keyring - doesn't work on a headless server (at least not too elegantly - the ssh passphrase keyring is much nicer)
the encrypted .netrc file on my hard-drive method - poor man's manual keyring implementation?
Come on, there's got to be some proper terminal-based keychain for Linux that can be hooked to git's credential.helper!
I would still recommend the method I describe in "Is there a way to skip password typing when using https://github.com"
Encrypting your .netrc allows you to store multiple credentials (to GitHub, and BitBicket, and ...) in one file, and have it used through the git credential helper netrc (git1.8.3+).
And it is compatible with the Github two-factor authentication, as I detail in "Configure Git clients, like GitHub for Windows, to not ask for authentication".
It works on Windows (and Linux or Mac).
And you can limit the number of minutes/hours during which gpg won't ask you again for the private key passphrase.
The 2022 answer would be to use the Microsft cross-platform GCM (Git Credential Manager)
See "Git Credential Manager: authentication for everyone" (Ensuring secure access to your source code is more important than ever. Git Credential Manager helps make that easy) from Matthew John Cheetham (Senior Software Engineer at #github).
Hello, Linux!
In the quest to become a universal solution for Git authentication, we’ve worked hard on getting GCM to work well on various Linux distributions, with a primary focus on Debian-based distributions.
Today we have Debian packages available to download from our GitHub releases page, as well as tarballs for other distributions (64-bit Intel only). Being built on the .NET platform means there should be a reduced effort to build and run anywhere the .NET runtime runs. Over time, we hope to expand our support matrix of distributions and CPU architectures (by adding ARM64 support, for example).
Due to the broad and varied nature of Linux distributions, it’s important that GCM offers many different credential storage options. In addition to GPG encrypted files, we added support for the Secret Service API via libsecret (also see the GNOME Keyring), which provides a similar experience to what we provide today in GCM on Windows and macOS.
See Linux installation, and additional configuration.
This method is not recommend, but still if you are in rush and nothing else is working for you, Simply add a new remote as
git remote -rm origin
git remote add origin https://username:mypassword#github.com/path/to/repo.git
that's it now you don't need to enter password again and again
Note: This method doesn't work with two step authorization accounts

Resources