The new Remote Repositories extension for Visual Studio Code created a new experience that enables working with source code repositories directly inside the VS Code environment.
However, what happens if the remote repository you’re trying to change is not found? With cloning replaced by Remote Repositories support, you might run into issues with fatal errors.
In this article, we’ll go through different ways to fix this issue.
Fix #1: Set Remote Base URL
If you’re a newer programmer, the chances are that you might not have set the repo URL on your local repo.
To fix this issue, you’ll have to use the “git remote set” command. Here’s how it should look:
git remote set-url origin http://github.com/[Username]/[ProjectName].git git add *.java git commit -m "commit title" git push origin master
The issue should be solved automatically.
Fix #2: Use the Correct URL
If the previous case isn’t the problem, then you should check that the URL you’re using is the correct one. Here’s how you can do that:
- Use the command:
git remote -v
- The console should display what remote repository it is connected to by listing a URL that it uses to fetch and push changes in the form of
origin http://github.com/[Username]/[ProjectName].git (fetch)
origin http://github.com/[Username]/[ProjectName].git (push)
- If the URL doesn’t match what your GitHub displays, you’ll need to change it. You can use the remote set command to set the correct pathway:
git remote set-url origin http://github.com/[Username]/[ProjectName].git
If this doesn’t fix the issue, you might need to check other causes.
Fix #3: Check Your Password
Your URL might not be the problem after all. You should check if your password has been changed recently.
If you’ve changed your password, you need to make sure that it has been obtained from the credential manager on Mac or Windows or keychain access.
It can happen that the old password is still used, and the new one is not cached yet. If that’s the case, all github.com credentials should be removed immediately.
Here’s how to clear git-related info from Mac and Windows.
- Go to Keychain Access.
- Navigate your password.
- Delete all keys that are connected to the source control.
Follow the commands:
$ git credential-manager uninstall $ git credential-manager install
Fix #4: Temporary Fix (Not Recommended in the Long Run)
If there’s no GitHub entry present in the keychain access, then you can clone the app with the following:
git clone https://[email protected]/org/repo.git
Use this info:
- Username with your GitHub username
- Org with your organization name
- Repo with your repository name
Stick to the following steps:
- Access the git folder.
- Open the “config” file with notepad (or notepad++) or another editor.
- Change your URL to
- Save the code and push it.
Other Issues and Common Fixes
If you’re not a collaborator, then it’s possible that you can successfully authenticate your access on GitHub, but still can’t clone or push the changes.
The other problem is that there might be some spelling issues on your side. This might seem trivial, but a misplaced letter is all it takes.
Another issue can be related to git remove -v. It can be set to use HTTPS, but your repo doesn’t points to SSH. If that’s the case, you need to remove the “ssh” part and replace it with “https://.”
The last issue would be that the repository is deleted. In that case, there’s not much you can do but go directly to GitHub and check the project status for any changes.
How much RAM is enough for a VS code?
The VS code is considered lightweight and should run on your hardware without any problems. The recommended storage is 1GB.
Should you install the VS code on SSD or HDD?
The SSD has a quality IO, so it’s recommended that you install your VS code on your SSD disk.
Can you use the VS code offline?
Yes. The code can be used offline. You just need to install Microsoft extensions.
Remote access has worked great for most users, but there’s still a chance of error when trying to push changes directly to a repository. We hope you’ve been able to fix the issue.
Have you found another solution to missing repositories problem in VS Code? Let us know in the comments.