I am using a fresh install of Visual Studio 2017 (15.8.1), and Git tools.
When I try to clone an existing GitHub repository, either by using the commandline tools, or by using git tools, I receive the following error message:
git#github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
I believe this error is caused by SSH and I cannot seem to make git use HTTPS. Thanks in advance.
If you are using 2-factor authentication at GitHub
You must either do one of the following:
Use the SSH link, add an SSH key to your GitHub account and load it using the SSH agent in Windows, this may be done using Putty.
Generate a personal access token, and use the HTTPS link. Use your GitHub username as the username, but use the generated access token as your password.
If you want to clone any repository using https
Simply clone it using the HTTPS-link instead of the SSH link. You can find both links here, by clicking on Use SSH, you can switch to the SSH link:
In my case, I had to delete ~/.ssh/known_hosts file, so that a new one will be made next time you access git over ssh.
I am using Git on Windows. I installed the msysGit package. My test repository has a self signed certificate at the server. I can access and use the repository using HTTP without problems. Moving to HTTPS gives the error:
SSL Certificate problem: unable to get local issuer certificate.
I have the self signed certificate installed in the Trusted Root Certification Authorities of my Windows 7 - client machine. I can browse to the HTTPS repository URL in Internet Explorer with no error messages.
This blog post by Philip Kelley explained that cURL does not use the client machine's certificate store. I followed the blog post's advice to create a private copy of curl-ca-bundle.crt and configure Git to use it. I am sure Git is using my copy. If I rename the copy; Git complains the file is missing.
I pasted in my certificate, as mentioned in the blog post, I still get the message "unable to get local issuer certificate".
I verified that Git was still working by cloning a GitHub Repository via HTTPS.
The only thing I see that's different to the blog post is that my certificate is the root - there is no chain to reach it. My certificate originally came from clicking the IIS8 IIS Manager link 'Create Self Signed Certificate'. Maybe that makes a certificate different in some way to what cURL expects.
How can I get Git/cURL to accept the self signed certificate?
The problem is that git by default using the "Linux" crypto backend.
Beginning with Git for Windows 2.14, you can now configure Git to use SChannel, the built-in Windows networking layer as the crypto backend. This means that it will use the Windows certificate storage mechanism and you do not need to explicitly configure the curl CA storage mechanism: https://msdn.microsoft.com/en-us/library/windows/desktop/aa380123(v=vs.85).aspx
Just execute:
git config --global http.sslbackend schannel
That should help.
Using schannel is by now the standard setting when installing git for Windows, also it is recommended to not checkout repositories by SSH anmore if possible, as https is easier to configure and less likely to be blocked by a firewall it means less chance of failure.
Open Git Bash and run the command if you want to completely disable SSL verification.
git config --global http.sslVerify false
Note: This solution opens you to attacks like man-in-the-middle attacks.
Therefore turn on verification again as soon as possible:
git config --global http.sslVerify true
I had this issue as well. In my case, I was trying to get a post-receive Git hook to update a working copy on a server with each push. Tried to follow the instructions in the blog you linked to. Didn't work for me as well and overriding the settings on a per-user basis didn't seem to work either.
What I ended up having to do was disable SSL verification (as the article mentions) for Git as a whole. Not the perfect solution, but it'll work until I can figure out a better one.
I edited the Git config text file (with my favorite line-ending neutral app like Notepad++) located at:
C:\Program Files (x86)\Git\etc\gitconfig
In the [http] block, I added an option to disable sslVerify. It looked like this when I was done:
[http]
sslVerify = false
sslCAinfo = /bin/curl-ca-bundle.crt
That did the trick.
NOTE:
This disables SSL verification and is not recommended as a long term solution.
You can disable this per-repository which still isn't great, but localizes the setting.
With the advent of LetsEncrypt.org, it is now fairly simple, automated and free to set up SSL as an alternative to self-signed certs and negates the need to turn off sslVerify.
kiddailey I think was pretty close, however I would not disable ssl verification but rather rather just supply the local certificate:
In the Git config file
[http]
sslCAinfo = /bin/curl-ca-bundle.crt
Or via command line:
git config --global http.sslCAinfo /bin/curl-ca-bundle.crt
I faced this issue as well. And finally got resolved by getting guidance from this MSDN Blog.
Update
Actually you need to add the certificate in git's certificates file curl-ca-bundel.cert that resides in Git\bin directory.
Steps
Open your github page in browser, and click over lock icon in address bar.
In the opened little popup up navigate to 'view certificate' link, it will open a popup window.
In which navigate to certificates tab (3rd in my case). Select the top node that is root certificate. And press copy certificate button in the bottom and save the file.
In file explorer navigate Git\bin directory and open curl-ca-bundle.crt in text editor.
Open the exported certificate file (in step 3) in text editor as well.
Copy all of the content from exported certificate to the end of curl-ca-bundle.crt, and save.
Finally check the status. Please note that backup curl-ca-bundle.crt file before editing to remain on safe side.
An answer to Using makecert for Development SSL fixed this for me.
I do not know why, but the certificate created by the simple 'Create Self Signed Certificate' link in IIS Manager does not do the trick. I followed the approach in the linked question of creating and installing a self-signed CA Root; then using that to issue a Server Authentication Certificate for my server. I installed both of them in IIS.
That gets my situation the same as the blog post referenced in the original question. Once the root certificate was copy/pasted into curl-ca-bundle.crt the git/curl combo were satisfied.
To avoid disabling ssl verification entirely or duplicating / hacking the bundled CA certificate file used by git, you can export the host's certificate chain into a file, and make git use it:
git config --global http.https://the.host.com/.sslCAInfo c:/users/me/the.host.com.cer
If that does not work, you can disable ssl verification only for the host:
git config --global http.https://the.host.com/.sslVerify false
Note : Subjected to possible man in the middle attacks when ssl verification is turned off.
In case of github Repositories (or any none-self-signed certs), choosing below while installing Git-on-windows, resolved the issue.
To completely detail out the summary of all the above answers.
Reason
This problem is occuring because git cannot complete the https handshake with the git server were the repository you are trying to access is present.
Solution
Steps to get the certificate from the github server
Open the github you are trying to access in the browser
Press on the lock icon in the address bar > click on 'certificate'
Go to 'Certification Path' tab > select the top most node in the hierarchy of certificates > click on 'view certificate'
Now click on 'Details' and click on 'Copy to File..' > Click 'Next' > Select 'Base 64 encoded X509 (.CER)' > save it to any of your desired path.
Steps to add the certificate to local git certificate store
Now open the certificate you saved in the notepad and copy the content along with --Begin Certificate-- and --end certificate--
To find the path were all the certificates are stored for your git, execute the following command in cmd.
git config --list
Check for the key 'http.sslcainfo', the corresponding value will be path.
Note: If u can't find the key http.sslcainfo check for Git's default path: C:\Program Files\Git\mingw64\ssl\certs
Now open 'ca-bundle.crt' present in that path.
Note 1 : open this file administrator mode otherwise you will not be able to save it after update. (Tip - you can use Notepad++ for this
purpose)
Note 2 : Before modifying this file please keep a backup elsewhere.
Now copy the contents of file mentioned in step 1 to the file in step 4 at end file, like how other certificates are placed in ca-bundle.crt.
Now open a new terminal and now you should be able to perform operations related to the git server using https.
I've just had the same issue but using sourcetree on windows Same steps for normal GIT on Windows as well. Following the following steps I was able to solve this issue.
Obtain the server certificate tree
This can be done using chrome.
Navigate to be server address.
Click on the padlock icon and view the certificates.
Export all of the certificate chain as base64 encoded files (PEM) format.
Add the certificates to the trust chain of your GIT trust config file
Run "git config --list".
find the "http.sslcainfo" configuration this shows where the certificate trust file is located.
Copy all the certificates into the trust chain file including the "- -BEGIN- -" and the "- -END- -".
Make sure you add the entire certificate Chain to the certificates file
This should solve your issue with the self-signed certificates and using GIT.
I tried using the "http.sslcapath" configuration but this did not work. Also if i did not include the whole chain in the certificates file then this would also fail. If anyone has pointers on these please let me know as the above has to be repeated for a new install.
If this is the system GIT then you can use the options in TOOLS -> options
GIt tab to use the system GIT and this then solves the issue in sourcetree as well.
I have had this issue before, and solve it using the following config.
[http "https://your.domain"]
sslCAInfo=/path/to/your/domain/priviate-certificate
Since git 2.3.1, you can put https://your.domain after http to indicate the following certificate is only for it.
Jan 2021 - Got around this in VS2019 by setting Menu > Git > Settings > Git Global Settings > Cryptographic Network Provider > [Secure Channel] instead of [OpenSSL]
Git SSL certificate problem unable to get local issuer certificate (fix)
PS: Didn't need to set --global or --local http.sslVerify false. I was cloning an Azure DevOps repo which wasn't using any self signed certs.. This seems like an issue with either VS2019 or Git for Windows.. They need to fix it !!
In my case, as I have installed the ConEmu Terminal for Window 7, it creates the ca-bundle during installation at C:\Program Files\Git\mingw64\ssl\certs.
Thus, I have to run the following commands on terminal to make it work:
$ git config --global http.sslbackend schannel
$ git config --global http.sslcainfo /mingw64/ssl/certs/ca-bundle.crt
Hence, my C:\Program Files\Git\etc\gitconfig contains the following:
[http]
sslBackend = schannel
sslCAinfo = /mingw64/ssl/certs/ca-bundle.crt
Also, I chose same option as mentioned here when installing the Git.
Hope that helps!
When using Windows, the problem resides that git by default uses the "Linux" crypto backend. Starting with Git for Windows 2.14, you can configure Git to use SChannel, the built-in Windows networking layer as the crypto backend. To do that, just run the following command in the GIT client:
git config --global http.sslbackend schannel
This means that it will use the Windows certificate storage mechanism and you don't need to explicitly configure the curl CA storage (http.sslCAInfo) mechanism.
One thing that messed me up was the format of the path (on my Windows PC). I originally had this:
git config --global http.sslCAInfo C:\certs\cacert.pem
But that failed with the "unable to get local issuer certificate" error.
What finally worked was this:
git config --global http.sslCAInfo "C:\\certs\\cacert.pem"
solved my problem
git config --global http.sslBackend schannel
Download certificate from this link:
https://github.com/bagder/ca-bundle
Add it to C:\Program Files\Git\bin and C:\Program Files\Git\mingw64\bin
Then try something like: git clone https://github.com/heroku/node-js-getting-started.git
git config --global http.sslVerify false
To fix the especific error SSL certificate problem: unable to get local issuer certificate in git
I had the same issue with Let's Encrypt certificates .
An web site with https we just to need :
SSLEngine On
SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
but git pull says :
fatal: unable to access 'https://example.com/git/demo.git/': SSL certificate problem: unable to get local issuer certificate
To fix it, we need also add:
SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem
In my case, I had to use different certificates for different git repositories.
Follow steps below (If you have a certificate of your repository, you can read from step 5)
Go to remote repository's site. Ex: github.com, bitbucket.org, tfs.example...
Click Lock icon on the upper left side and click Certificate.
Go to Certification Path tab and double click to .. Root Certificate
Go to Details tab and click Copy to file.
Export/Copy certificate to wherever you want. Ex: C:\certs\example.cer
Open git bash at your local repository folder and type:
$ git config http.sslCAInfo "C:\certs\example.cer"
Now you can use different certificates for each repository.
Remember, calling with the --global parameter will also change the certificates of git repositories in other folders, so you should not use the --global parameter when executing this command.
git config --global http.sslbackend secure-transport
(had to do that after update to Big Sюr)
This works for me. I opened cmd line and ran following command. and pulled again.
git config --global http.sslVerify false
I've had the same problem from Azure DevOps (Visual Studio). Finally I've decided to clone my repo using SSH protocol because of i've prefered it instead of disabling SSL verification.
You only need to generate a SSH Key, you can do it so... SSH documentation
ssh-keygen
And then, import your public key on yout git host (like Azure Devops, Github, Bitbucket, Gitlab, etc.)
I had this error occur when using visual studio. This occurs when you have the Cryptographic Network provider settings set to OpenSSL in the Visual Studio Options window. When I changed the setting to Secure Channel it solved it for me. This setting must have been set for me when I upgraded my VS.
Error
push failed
fatal: unable to access
SSL certificate problem: unable to get local issuer certificate
Reason
After committing files on a local machine, the "push fail" error can occur when the local Git connection parameters are outdated (e.g. HTTP change to HTTPS).
Solution
Open the .git folder in the root of the local directory
Open the config file in a code editor or text editor (VS Code, Notepad, Textpad)
Replace HTTP links inside the file with the latest HTTPS or SSH link available from the web page of the appropriate Git repo (clone button)
Examples:
url = http://git.[host]/[group/project/repo_name] (actual path)
replace it with either
url = ssh://git#git.[host]:/[group/project/repo_name] (new path SSH)
url = https://git.[host]/[group/project/repo_name] (new path HTTPS)
I have resolved the issue by adding below entry in ${HOME}/.gitconfig file
[remote "origin"]
proxy=
In most case it will happen when proxy enabled in your machine so above mentioned entry will fix this problem.
You might have a DNS issue and not a certificate issue, so before you disable SSL verification in your Git shell you should rule out a DNS problem. Cases such as these have been mentioned in Q&A forums such as https-issues-possibly-related-to-dns. If you are using WSL on Windows as your terminal, then you can try running sudo echo nameserver 8.8.8.8 > /etc/resolv.conf and then issue the git commands to see if that makes a difference. This does not seem to be a permanent DNS fix (lasting only the lifetime of your terminal session), but it could help you determine whether it is a DNS issue and not a certificate issue. You could also check this document on configuring your network to use a public DNS. Again, this is only to help you determine if your DNS settings might need adjusting in order to help resolve the certificate issues.
Download and install local certificate. Probably it is published at your company site. For instance, *.cer file.
Right click it and select Install Certificate. 'Certificate Inport Wizard' will appear. Select Local Machine. Press Next, confirm.
Select Place all certificates in the following store, press Browse and select Trusted Root Certification Authorities, OK, Finish.
Also you can check if other applications can fetch, pull or push data. For instance, in Android Studio or probably IDEA you should select in Settings this checkbox: Use credential helper.
I got this error when trying to "clone" the project. One work-around is to just use the "download as zip" on the webpage, which, for me, achieved what I wanted to do.
This might help some who come across this error. If you are working across a VPN and it becomes disconnected, you can also get this error. The simple fix is to reconnect your VPN.
Every time I try to push a repository in GitHub with Pycharm the it fails.
Push failed: fatal: Authentication failed for 'https://github.com/(my github repository)/'
In Settings->Version Control->GitHub, I filled the fields Host, Loging and Password (Auth Type: Password). Testing it: "Connection successful"
In Settings->Version Control->Git, Path to Git executable is seted with the full path, SSH executable: Buil-in
Pycharm version 3.1.1
Git version 1.8.4.msysgit.0
On Win 7.
I tried all but it worked me charm :
The problem I had : Every thing was working from terminal and from Github desktop as well.
But when I tried to PUSH/PULL from pycharm it wasn't working.
Reason : It happens because by-default pycharm save password locally in DB.
Work around: Go to File > Settings > Appearance & Behavior > System Settings> Passwords, clicked on 'Do not save..", restarted IntelliJ and VCS asked for password again.
It seems there is some issue (if using https) if username or password contains "some" special characters.
So, I've generated a secondary password ("personal access token") in GitHub's application settings page (using the "Create new token" button), I did copy this token. Then I've selected Auth Type: Token in Settings->Version Control->GitHub, and pasted the token.
Testing it: Connection successful for user . Now the git push works perfectly.
I struggled with this problem for half a day using Git in PyCharm.
Solution: Settings => Version Control => Git => ticked "Use credential helper" and then it worked perfect.
If your username or password has special characters, you can replace it with the Percent-encoding for theses characters.
for example, if your password is "test#2010", you will write it as "test%402010" and the config command will be like this
git config remote.origin.url https://{username}:test%402010#github.com/{repo_username}/{repo_name}.git
So I found the solution to my problem, and I hope this helps:
If you are using KDE, or Gnome, your "KDE Wallet", or "Gnome Keyring" manager will save your password when you push for the first time. However, if you enter the password wrong, these managers (ksshaskpass for KDE) will store the wrong password and will send the wrong password every time.
To fix this, open the appropriate manager and change the password. With KDE, it is in: Kick-off-menu > System Settings > Account Details > KDE Wallet, then click "Launch Wallet Manager", and find "ksshaskpass", expand it, and then expand "Passwords", then find your github registered email address there, click it, and on the right, click on "Show Contents". Now change that value (in case wrong password), then hit save. and you're done!
Now that means you don't have to type in your password each time for https push, and you don't have to use SSH keys either ;)
I came across this once. Turned out that the Web Credentials in the Credentials Manager stored an incorrect password for github.com and gitlab.com.
I removed that and it gave me the option to log in when I added a new repository.
Ok guys, I tried all suggested solutions and they did not worked for me.
I use git bash and bitbucket.
Finally I turned it upsidedown, and it worked - at least that way. I know this is difficult and foolish solution, but it worked.
So the steps:
you have your code on your local machine.
you have your repo /on bitbucket/
Delete your repo or make a new one with new name
Make a readme.md with the help of the /bitbucket's/ dashbord
clone the new repo
copy your files into this new folder which you want to push
do the git bash work (add,commit) and push it to the repo.
In PyCharm go to:
Settings > Version Control > Github > +
add credentials
AND:
Check your open browsers, when logging in from pycharm into GitHub a tab is opened to authorize Jetbrains the access to your Github account.
I am using High Sierra on an old iMac and originally tried to push a new local project to a new remote.
Unable to get authentication working on Terminal I then tried to use PyCharm as a vehicle to save the authentication token from Github.
In the past I was accustomed to the IDE prompting for the use of a token and even suggesting me to open Github.com to generate the appropriate one.
PyCharm was not able to push a new branch but it did not give any such hints for a solution in the error message
12:56 Push failed
git#github.com: Permission denied (publickey).
Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Show details in console
My solution was to go into the settings and there I found the connection to Github unset - and I was able to link a token.
But I also had to set the remote with the HTTPS link. When I tried with the SSH URI it did not work.
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