user1559230
user1559230

Reputation: 2821

How to pull/fetch a branch from github to local?

I need to switch to a local brach master to a github branch feature/ABF-3-project-structure

I run the below command.

git pull feature/ABF-3-project-structure

this is output of the command

enter image description here

Please help me out. I have tried for at least 3 hours but still no luck

Thanks, Enamul

Upvotes: 2

Views: 4665

Answers (3)

user1559230
user1559230

Reputation: 2821

I have solved this problem by adding ssh key to github. I previously working on git with out setting ssh key on github.

It's very simple. I just added the ssh key and run the previous commands. That solves my problem. :)

Upvotes: 1

Greg Motyl
Greg Motyl

Reputation: 2555

Try this:

git pull {repo} {remotebranchname}:{localbranchname}

git pull origin abc:abc

In case when you are on the master branch you also should first checkout a branch:

 git checkout -b abc 

this should create new branch "abc" from the master and directly check it out. than you should run:

 git pull origin abc 

to pull the new branch to your local abc branch

Upvotes: 2

Klaymen
Klaymen

Reputation: 75

I'm not sure if I understand your question, but switching to the mentioned branch can be done with the following code: git checkout feature/ABF-3-project-structure.

Upvotes: 3

Related Questions