Via Git UI and Turtoise UI I updated the local and remote GIT repositories. I would like to interact with the gitlab.com repositories in Android Studio and IntelliJ. I keep on getting 401 or read errors.
In IntelliJ I tried to connect to the remote repository via VCS > GIT > Remotes and added the gitlab.com SSH entry. Also in Android Studio I could not connect to the remote repository.
SOLUTION: thanks to VonC. The SSH keys I registered at Gitlab.com were in my c:\users\myusername\.ssh folder. Via the Turtoise and GIT UI I could refer directly to these files.
Both the Android Studio and IJ IDE's use the %HOME% folder to find the SSH keys. This folder may refer tot the System's SSH folder. Because no SSH keys were available in that folder, I kept on getting connection errors.
The solution was in creating a command (.bat) file that does the following for IntelliJ:
set HOME=%USERPROFILE%
c:
cd "C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.3.1\bin"
idea.exe
And for AS:
set HOME=%USERPROFILE%
c:
cd C:\Program Files\Android\Android Studio1\bin
studio64.exe
Let's be clear: if you are using https url, and your username/password GitLab.com account, your ssh keys have nothing to do with your connection attempt: those ssh keys (puttygen or not) will be ignored.
For https, you need your GitLab account credentials, and if your GitLab password has a special character in it, it needs to be percent encoded (like a
@
).See also "Handling Passwords for Git Remote Repositories" (again, nothing to do with ssh).
If you select "Clone git repositories using ssh" (as in this answer), then, even if Git does not find your ssh keys (or if your public key is not properly registered in your GitLab account), ssh will be able to fallback to the username/password authentication scheme.
To use ssh urls in AS (Andoird Studio):
CMD
session whenHOME
(typeset HOME
) is set to%USERPROFILE%
,You must see in
%USERPROFILE%\.ssh
(or%HOME%\.ssh
) the filesid_rsa
andid_rsa.pub
. Noppk
puttygen keys required.The OP adds:
Actually, if HOME points to the system folder, it means AS is running with the system account, or Git was installed for the system account.
Don't:
HOME
should refers to%USERPROFILE%
, and make sureAS
is launched with your account. The OP notes: