How to connect in VS2015 to a remote private repository on Bitbucket-e?

I install in Team Explorer> Settings> Git> Repository Settings> Remotes> Add parameters:

Fetch: https://bitbucket.org/ {team_id} / {storage_name}

Push: https://bitbucket.org/ {team_id} / {storage_name}

When I try to push and query User / Pwd to the site: the bitbucket.org error occurs: "Error encountered while pushing the remote repository: Response status code does not indicate success: 401 (Unauthorized)."

PS Also installed SSH key on bitbucket.org.

They also write that VS2015 does not work via SSH, so the need to configure it is questionable.

SSH Config:

Host bitbucket.org IdentityFile ~/.ssh/id_rsa 

Stack trace over SSH connection:

 >ssh -Tv git@bitbucket.org ... debug1: Host 'bitbucket.org' is known and matches the RSA host key. debug1: Found key in /cygdrive/c/Users/xxx/.ssh/known_hosts:1 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Trying private key: /cygdrive/c/Users/xxx/.ssh/identity debug1: Offering public key: /cygdrive/c/Users/xxx/.ssh/id_rsa debug1: Remote: Forced command: conq username: *bitbucket_user_login* debug1: Remote: Port forwarding disabled. debug1: Remote: X11 forwarding disabled. debug1: Remote: Agent forwarding disabled. debug1: Remote: Pty allocation disabled. debug1: Server accepts key: pkalg ssh-rsa blen 149 Enter passphrase for key '/cygdrive/c/Users/xxx/.ssh/id_rsa': Enter passphrase for key '/cygdrive/c/Users/xxx/.ssh/id_rsa': Enter passphrase for key '/cygdrive/c/Users/xxx/.ssh/id_rsa': debug1: Trying private key: /cygdrive/c/Users/xxx/.ssh/id_dsa debug1: No more authentication methods to try. Permission denied (publickey). 

Another problem with ssh-agent (ohm):

 >ssh-agent -s SSH_AUTH_SOCK=/tmp/ssh-djump24624/agent.24624; export SSH_AUTH_SOCK; SSH_AGENT_PID=28000; export SSH_AGENT_PID; echo Agent pid 28000; >ssh-add ~/.ssh/id_rsa Could not open a connection to your authentication agent. 

View from Git-Bash (with Git-Bash, the problem is solved via Run as administrator):

 xxx@LocalPC MINGW64 ~ $ cd ~/.ssh/ xxx@LocalPC MINGW64 ~/.ssh $ dir config id_rsa id_rsa.pub known_hosts xxx@LocalPC MINGW64 ~/.ssh $ ssh -Tv git@bitbucket.org OpenSSH_7.1p1, OpenSSL 1.0.2d 9 Jul 2015 debug1: Reading configuration data /c/Users/xxx/.ssh/config debug1: /c/Users/xxx/.ssh/config line 1: Applying options for bitbucket.org debug1: Reading configuration data /etc/ssh/ssh_config debug1: Connecting to bitbucket.org [131.103.20.167] port 22. debug1: Connection established. debug1: identity file /c/Users/xxx/.ssh/id_rsa type 1 debug1: key_load_public: No such file or directory debug1: identity file /c/Users/xxx/.ssh/id_rsa-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_7.1 debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3 debug1: match: OpenSSH_5.3 pat OpenSSH_5* compat 0x0c000000 debug1: Authenticating to bitbucket.org:22 as 'git' debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-ctr umac-64@openssh.com none debug1: kex: client->server aes128-ctr umac-64@openssh.com none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<3072<8192) sent debug1: got SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: got SSH2_MSG_KEX_DH_GEX_REPLY debug1: Server host key: ssh-rsa SHA256: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx debug1: Host 'bitbucket.org' is known and matches the RSA host key. debug1: Found key in /c/Users/xxx/.ssh/known_hosts:1 debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: Roaming not allowed by server debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Offering RSA public key: /c/Users/xxx/.ssh/id_rsa debug1: Remote: Forced command: conq username:*bitbucket_user_login* debug1: Remote: Port forwarding disabled. debug1: Remote: X11 forwarding disabled. debug1: Remote: Agent forwarding disabled. debug1: Remote: Pty allocation disabled. debug1: Server accepts key: pkalg ssh-rsa blen 149 Load key "/c/Users/xxx/.ssh/id_rsa": Permission denied debug1: No more authentication methods to try. Permission denied (publickey). 
  • ssh -T git@bitbucket.org what does output? - ExileeD
  • Writes that: Permission denied (publickey). - cpp_user
  • So you haven't configured ssh. You need to either add keys to ~ / .ssh / cofing or change origin to https, then every time you make a login, you will be asked for your login and password - ExileeD
  • The studio asks for Login / PWD and it does not help it, but Atlassian SourceTree somehow works the same. It is not entirely clear whether it is necessary to configure for SSH studio somehow or not. - cpp_user
  • What plugin is used for the studio? Atlassian SourceTree works through putty. And the studio is different - ExileeD

2 answers 2

I do not know how it is in VS2015, but I know that for bitbucket.org I need to specifically register IdentityFile, only after that you can communicate normally with the rep.

path to turnip:

 git@bitbucket.org:{user}/{rep}.git 

Register key for bitbucket.org

 $ cd .ssh $ touch config $ nano config Host bitbucket.org IdentityFile ~/.ssh/id_rsa 
  • Ps. As for SSH support, if there is none, then apparently it is not necessary, install it on a local git machine and freely clone the rep with bitbucket.org, having previously configured ssh. Well, with the local version of the gita, VS2015 will have no problems exactly. - Redr01d
  • What does it mean with “Well, and with the local version of the gita, VS2015 will have no problems exactly”? Microsoft Git Provider why not cope with this task? If it is meant to use a third-party program, so for this there is Atlassian Source Tree which also copes well with the task, but I would like to have a closer integration of VS2015 with Bitbucket. By default, VS2015 integrates with GitHub or TFS only. - cpp_user
  • Of course it can, but you correctly noticed it depends on the pre-installed integrations with the services. By local git I meant git-bash , which has the usual cmd functionality onboard, clone to the locale you want and from wherever you want and your Microsoft Git Provider will see it all. - Redr01d
  • I see you on top gave a stack trace. type in the config file manually (/c/Users/xxx/.ssh/config) Host bitbucket.org IdentityFile ~ / .ssh / id_rsa - Redr01d
  • All this has already been written in c / Users / xxx / .ssh / config and as a result such a stack trace comes out. - cpp_user

Visual Studio can only access git repositories via HTTPS and cannot work with SSH. Instructions for repository cloning are in another question .

  • By HTTPS, the studio does not ask for a login / password (the dialogue does not appear), but stupidly falls off: "The error encountered while pushing the remote repository: Response status code does not indicate success: 401 (Unauthorized)." - cpp_user