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 , 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?
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.
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 .
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.
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. :)
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With