Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check out a branch in Bitbucket

Tags:

git

bitbucket

I have a Git repository at https://[email protected]/path/git.git. This repository has a branch called feature/myFeature, which I want to check out. I have run

git init

in the desired folder, and then, according to Bitbucket, I need to run

git fetch && git checkout feature/myFeature

However, I get the following error,

fatal: No remote repository specified. Please, specify either a URL or a remote name from which new revisions should be fetched.

I guess I need to specify the repository, but I don't know how exactly to do this, and at the same time specify the branch.

What should I do?

like image 243
ChrisC Avatar asked Feb 11 '23 02:02

ChrisC


1 Answers

You need to add a remote first (git init just created an empty local repo):

git remote add origin https://[email protected]/path/git.git

Then you can fetch and checkout the remote tracking branch

like image 169
VonC Avatar answered Feb 13 '23 17:02

VonC