So I'm trying to create a remote branch so I can push updates to a project I'm doing to my Github account, but for whatever reason, my remote branches aren't being created.
These are the commands I am running:
git remote add origin [email protected]:<username>/first_app.git
git push origin master
After running the first line, everything seems to work fine and I don't get any error messages. BUT, when I check what remote branches I have, nothing will show. The command I ran for that was:
git branch -r
Ignoring that I figured I would at least try the second command from above. When I did, naturally, it says:
ERROR: Repository not found
If someone could help me figure this out it would be greatly appreciated. I've been trying to find information on this online but haven't run into anything yet.
To see local branches, use the git branch command. The git branch command lets you see a list of all the branches stored in your local version of a repository. To see the remote branches associated with your repository, you need to append the -r flag to the end of the git branch command.
To view your remote branches, simply pass the -r flag to the git branch command. You can inspect remote branches with the usual git checkout and git log commands. If you approve the changes a remote branch contains, you can merge it into a local branch with a normal git merge .
After you add remote, git does not have any knowledge about remote branches yet. In fact, remote URL could be very well invalid.
git fetch
command is designed to do the following:
.git/refs/remotes/remotename
and is not updated until next git fetch
.In other words, doing git fetch
is almost mandatory for you.
By the way, git pull
= git fetch
+ git merge
, so doing git pull
will also accomplish what you want.
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