44

There is a "Push" menu item, but when I click on it, nothing happens except for a subtle progressing bar showing up and never finished. From Visual Studio Code's Docs page, I found this line: "Credential management is not handled by VSCode for now," and that page links to a GitHub page on credential helper, which is too specific for other remote server (in my case, bitbucket) and not specific enough on how to set up for VS Code.

Makoto
  • 96,408
  • 24
  • 164
  • 210
zhouji
  • 2,040
  • 3
  • 15
  • 13
  • Have you already setup access to your git repository using ssh or login/password? – Guy Bouallet May 01 '15 at 20:44
  • @SlawaEremkin I know how to use git. The problem is probably more about credential management. I will edit the question to make it clear. – zhouji May 01 '15 at 21:23
  • @GuyBouallet I know how to have the repository set up properly for SourceTree, but didn't figure out what I should do in VS Code, and I didn't see any message from CS Code. That is where I need help. – zhouji May 01 '15 at 21:27
  • According to the VSCode git menu, you need to open a folder with a Git repository in order to access Git features. Have you tried to clone a repo with SourceTree then use File -> Open folder is VSCode and check if git features are accessible? – Guy Bouallet May 01 '15 at 21:32
  • Maybe I should ask "How to set up ssh for git in VS Code?" I just didn't want to guess the reason - all I saw is no response when I click "Push". – zhouji May 01 '15 at 21:37
  • 4
    @GuyBouallet I can do commit and other git functionality with no problem, but cannot push to the remote server. That is why I asked about push, not git in general. Somebody removed my 'push' tag. – zhouji May 01 '15 at 21:39
  • OK. Have you tried to push using source tree. It is probably a problem that is not related to VS Code but to the push command itself. The never ending progress bar could be just a bad error handling. – Guy Bouallet May 01 '15 at 21:43

5 Answers5

41

If you are in windows use this line in your git bash:

git config --global credential.helper wincred

Next time git will remember your password. Thats all, the VSCode will work fine ;)

Bye Bytes !

dalle
  • 16,659
  • 3
  • 53
  • 75
  • 4
    Also, [this answer](http://stackoverflow.com/a/15382950/1061340) gives directions about where are these credentials saved in Windows, and how can you manage them (Edit or Delete). – noquierouser May 30 '15 at 18:36
  • 3
    Great! This works. You need to push it once on the command line after that config command. – zhouji Jun 12 '15 at 21:53
  • 5
    Can't VS Code ask us for the password everytime I push or pull? Coz I seriously don't want to communicate with Central Repo without password. – shashwat Jul 22 '15 at 04:47
  • @zhouji - You fixed my problem. My credentials weren't being authenticated until I pushed once from the console after the config command. – docta_faustus Feb 03 '16 at 04:29
  • I have wincred correctly setted as my credential helper and it keeps giving me this output ```git pull Permission denied, please try again. Permission denied, please try again. Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). fatal: Could not read from remote repository.``` – Kutyel Apr 14 '16 at 12:48
11

Tell Git your name so your commits will be properly labeled. Type everything after the $ here:

git config --global user.name "YOUR NAME"

Tell Git the email address that will be associated with your Git commits. The email you specify should be the same one found in your email settings on Github. To keep your email address hidden, see "Keeping your email address private".

git config --global user.email "YOUR EMAIL ADDRESS"

See this : Set Up Git

behzad abbasi
  • 131
  • 1
  • 4
  • or you can use an extension to set it locally for each repo (handy if have separate emails for work and oss ): https://marketplace.visualstudio.com/items?itemName=shyykoserhiy.git-autoconfig – shyyko.serhiy Apr 14 '17 at 18:56
7

If you (or future searchers) are looking for instructions specifically for bitbucket (although for git more generally) Here is the Atlassian help page for permanently authenticating using credential caching.

travistravis
  • 257
  • 3
  • 5
5

Currently, VSCode implements git integration by spawning git. If git push works on your command line without prompting for username / password, it should work from VSCode too.

I don't know if setting up SourceTree to not prompt for a username / password is sufficient to get vanilla command line git not prompt as well.

Alex Dima
  • 17,553
  • 1
  • 12
  • 13
0

if you want push to an own server where you need to enter a password because you use ssh authentification you can do it like this:

Start Visual Studio Code from the git commandpromt with the command code

I found this at the end of this page https://code.visualstudio.com/Docs/editor/versioncontrol in the FaQ the Question was "Can I use SSH Git authentication with VS Code?"

now every time you interact with the git server you get prompted for the password

here is a guide how to run a command with git when you open git Windows shortcut to run git bash script

Spiegie
  • 22
  • 6