1

I just got a new laptop.

On old laptop, I am using Visual Studio Enterprise 2017 version 15.9.43. On new laptop, I am using Visual Studio Enterprise 2017 version 15.9.44.

On Git, I cloned the TFS repository using SSH.

On old laptop, I am able to clone or pull/push codes in Visual Studio, so that means my user name does have the access to the repository, and the repository exists.

On new laptop, I am able to clone the repository using Git Bash. But, when trying to do that in Visual Studio, I am getting an error

"Git failed with a fatal error.
 Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. "

enter image description here

On both old and new laptop, the Visual Studio Git Settings are the same, ie Cryptographic network provider on both laptops are set to OpenSSL.

On new laptop I have created SSH key added the SSH Public keys to TFS Git.

How can I fix this error ?

Thank you

faujong
  • 757
  • 12
  • 32

1 Answers1

0

Make sure you add this: git remote add origin [your repository link] before git push -u origin [Your Branch] --force

  • 1
    Hi, I am doing this from Visual Studio. I added a print screen in my original post. Where do I add that command in Visual Studio when cloning the repository ? From Git Bash, I have no issue. Only from Visual Studio I am getting the error. Thank you – faujong Feb 24 '22 at 13:34
  • Okay I understand your problem. If that one up here and is not working for you just try this one: https://stackoverflow.com/questions/34634364/to-use-git-push-on-visual-studio-code-but-show-could-not-read-from-remote-re – Adamu Abdulkarim Feb 24 '22 at 15:41
  • Follow the link – Adamu Abdulkarim Feb 24 '22 at 15:42
  • Hi, that link is for Visual Studio Code, I am doing it from Visual Studio 2017. Based on the article, I also tried this in command prompt, but I am still having the same issue: cmd /c start-ssh-agent & "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\devenv.exe" – faujong Feb 24 '22 at 22:18
  • Sorry I thought it was visual studio code try this maybe it can helps: https://stackoverflow.com/questions/42667928/visual-studio-2017-git-failed-with-a-fatal-error?page=2&tab=Votes – Adamu Abdulkarim Feb 25 '22 at 10:35