Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't update: no tracked branch

I am on Android Studio (Preview) 0.6.0 on Windows and was trying to share my project on GitHub. I used Git Shell to initialize, add, commit and push the project to GitHub. But when I tried to update my project from within Android Studio enter image description here, I got this error:

Can't update: no tracked branch No tracked branch configured for branch master. To make your branch track a remote branch call, for example, git branch --set-upstream master origin/master 

It does provide this suggestion but I am not sure what to do at this point. Is there a way to fix this from within Android Studio?

like image 601
Prince Avatar asked Jun 13 '14 23:06

Prince


People also ask

Can not update has no tracked branch?

If you have new commit in origin and not get those files; also you have changed the local master branch files then you got this error. You should fetch again to a new directory and copy your files into that path. Finally, you should commit and push your changes.

How do I change the tracking on my remote branch?

Change tracking We can change a local branch tracking to a new remote by using the git push command followed by -u flag and origin your-branch-name .

What does set as tracked branch mean?

Tracking branches are local branches that have a direct relationship to a remote branch. If you're on a tracking branch and type git pull , Git automatically knows which server to fetch from and which branch to merge in.


2 Answers

If I'm not mislead, you just need to set your local branches to track their pairs in the origin server.

Using your command line, you can try

git checkout mybranch git branch --set-upstream-to=origin/mybranch 

That will configure something as an equivalent of your local branch in the server. I'll bet that Android Studio is complaining about the lack of that.

If someone knows how to do this using the GUI of that IDE, that would be interesting to read. :)

like image 67
D. Melo Avatar answered Oct 14 '22 12:10

D. Melo


So after reading a bit on how git sets up the repo. I realized that I ran the command

git push origin master 

but instead for the first time I should have ran

git push -u origin master 

which sets up the upstream initially. Way to go!

like image 34
Prince Avatar answered Oct 14 '22 14:10

Prince