Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vscode not showing git password prompt

I have a git repo on a remote server and use ssh with password authentication to clone,pull,push. From command line everything works fine.

However in vscode when I try to pull or push from remote repository, no password prompt is shown. Vscode seems to be waiting for something but nothing happens. Is this a bug, or am I doing something wrong?

I want to use visual studio code as git client on linux.

From command line:

enter image description here

In vscode:

enter image description here

like image 939
mihca Avatar asked Jun 20 '18 15:06

mihca


People also ask

How do I add Git credentials in Visual Studio Code?

Steps to add git credentials in vs code Step 1: Download git from the official website https://git-scm.com and install it. Step 2: When you're finished installing Git, start Visual Studio Code and verify that Git is now identified. Step 3: Start a new Terminal and configure your 'user.name' and 'user.

How do I set Git credentials in Visual Studio?

To configure Git settings in Visual Studio, choose Settings from the top-level Git menu. Choose Git Global Settings or Git Repository Settings to view and configure global-level or repository-level settings. You can configure several common Git settings, as described in the following sections of this article.


1 Answers

There are two solutions I can think of:

  • Set up an SSH key so that you never need credentials for accessing the server the remote repository is on
  • Tell git to remember credentials when you type them in - this answer tells you how

EDIT:

Here is a quick recipe how to set up an SSH key for your git repo:

On the client side (where you cloned the repository)

  • Check if you have an ssh key in ~/.ssh
  • If not, generate an SSH key without passphrase using ssh-keygen (mine is called id_rsa)
  • add this key to the authentication agent using ssh-add ~/.ssh/id_rsa

On the remote side (where the repo is hosted)

  • create the file ~/.ssh/authorized_keys
  • into this file copy and past your public key, which you just created on the client side (mine is saved in ~/.ssh/id_rsa.pub)

Afterwards try a git pull on the client side. It should not ask for a password anymore and pull/push from vscode should work as well

like image 154
hitecherik Avatar answered Oct 27 '22 00:10

hitecherik