How to configure VS Code to work with git? I'm using the standard scm provider in VS Code. I installed git on my pc, initialized the repository in a folder, made some changes and VS shows that it has been committed but I don't see in on my github, and when I want to pull from git VS shows "Your repository has no remotes configured to pull from."
2 Answers
You first need to add your GitHub repo as a remote! To do this you can follow the Official Guide.
git remote add origin https://github.com/user/repo.git
#optionals below just to verify
git remote -v
origin https://github.com/user/repo.git (fetch)
origin https://github.com/user/repo.git (push)
Then you can push your local commits with official guide
git push -u origin master
You can add remote directly from VS Code as introduced here
7 Comments
fxvlad
I typed git remote add origin github.com/myUserName/myRepoName.git in the integrated terminal in VS. Now it shows on git remote -v: origin github.com/myUserName/myRepoName.git (fetch) origin github.com/myUserName/myRepoName.git (push) but still no my repo on my github
dstrants
You have to use the link to your own repository instead of the sample link github.com/myUserName/myRepoName.git
fxvlad
I initialized it. Then typed: <br> git remote add origin github.com/myUserName/myRepoName.git <br> git push -u origin master <br> It shows that repository not found
dstrants
You have initialized the repo locally. You just have to do some short of the same thing on the remote repo and get the appropriate link. Just follow these steps
fxvlad
Aaargh, finally got it, Thank you so much! Is it possible to create repo via the integrated terminal in VS without going to github directly?
|
You need to push your local commits to your remote. Check out Git Status Bar Actions and Remotes.
git remote -v? It sounds like you haven't pushed any changes to the remote.