Reputation: 1454
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.
Upvotes: 9
Views: 14247
Reputation: 116397
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.
Upvotes: 13