Search code examples
gitvisual-studioversion-controlbitbucketfetch

Git Visual Studio with Bitbucket confluence Connect to existing project error / Fetch fails


How do you pull from existing Bitbucket GIT repo using Visual Studio 17?

Error "git failed with a fatal error. 'xyz' repository not found "

  1. I added this Misty BitBucket Extension from the marketplace
  2. Then I added the Git remote string as below with three types of options and this help page.

First I tried this string -> https://<repo_owner>@bitbucket.org/<accountname>/<reponame>.git & https://<repo_owner>@bitbucket.org/<accountname>/<reponame> then I tried the URL path based on youtube videos & the over settings page https://bitbucket.org/myrepo/xos/src


  1. I get errors that the repo does not exist.

Would appreciate some help on how to setup/pull/fetch/sync code from Bitbucket.

Error from Console

Update 1: the error after adding the Clear Credentials Tool & extracting the SSHkey

Update 2: @Marina-Liu, even after hitting connect, bitbucket connection does NOT show up in Visual Studio 2017


Solution

  • If you are a user of the bitbucket repo, please make sure you have permission to clone the private repo. And then you can pull the bitbucket repo’s changes to the local existing repo.

    1. Login bitbucket.

    VS -> Manage connections -> login the bitbucket repo.

    enter image description here

    And you can also clone a bitbucket repo directly after login.

    enter image description here

    1. Add bitbucket repo as remote.

    In VS -> open your local repo -> in the right-bottom corner of VS -> it lists your repo folder name and branch name -> Team Explorer -> Settings -> Repository settings -> add remotes -> add a remote name (such as bit) -> input your bitbucket repo url (the format is https://bitbucket.org/account/reponame) -> save.

    enter image description here enter image description here

    1. Pull changes from bitbucket repo to the local existing repo.

    Fetch changes from bitbucket repo first:

    Team explorer -> Sync -> Fetch -> select the remote name you just added (such as bit) -> Fetch.

    enter image description here

    If the local existing repo has not the origin remote, you can pull changes from bitbucket repo directly. If the local repo has other remote(s) except bit, you should merge bitbucket repo's changes into the local branch:

    Team explorer -> Branches -> Merge -> assume merge bit/master into master branch -> merge.

    enter image description here


    To clone the bitbucket repo by command line, you can follow below steps:

    1. Clear existing credential

    Credential Manager -> Windows Credentials -> remove all the credentials about bitbucket.org

    enter image description here

    1. Clone by command line

    Now you can clone the butbucket repo by command git clone https://bitbucket.org/account/reponame directly, it will let you to input your email address and password.