fatal: not a git repository (or any of the parent directories).Git delete remote branch – how to delete a remote git branch.What is git ORIGIN & the git remote add command?.Resolve git message fatal: no such remote origin.You will now know what to do if you see the message “git fatal: The current branch has no upstream branch”, and have example commands to set the upstream branch in git, no matter what your branch name or remote name. You can read more about what Git Origin is here. What if your remote is not called the default name ‘ORIGIN’? Let’s say it’s called MY-REMOTE, and the branch is called master, then you would type the following command : git push -set-upstream MY-REMOTE master For instance: git pull If your remote is not called the default name ‘ORIGIN’ Once you’ve set the upstream branch, other commands will automatically use it too without you having to specify the remote branch name. So these two commands will do exactly the same thing: git push -set-upstream origin my-feature-branchįor any other information about flags to use with the git push command, read the official git push documentation. Often in git there are several ways of writing each flag. So if your current local branch was called my-feature-branch then you would type this instead: git push -set-upstream origin my-feature-branch What is git push -u ? I would always recommend keeping the name of your remote branch exactly the same as your local branch. gitconfig) for my aliases to work: alias trackgit branch -set-upstream-toorigin/(git symbolic-ref -short HEAD) So now I can just call track to set up the damn tracking information on. I run git from command line with cygwin and this is how I had to insert it into my. This would set the upstream branch of the current branch to ‘master’. There is a command to gain the current branch name. Then to set the upstream branch for that local branch, use these flags along with your git push command : git push -set-upstream origin master Read one of my other posts if you need to use git switch to change branches. Make sure you are already on the correct local branch, by using git status if you need to check which branch you are already on. To push the current branch and set the remote as upstream, use The error you see will look like this: $ git pushįatal: The current branch master has no upstream branch. If you get an error when you git push, then it could well be because your current branch has not yet been ‘linked’ to a remote branch. In this post I’ll explain how to set the upstream branch to your local branch. That means git doesn’t know where to push your changes to. In other words there is no upstream branch. If you see the message “the current branch has no upstream” in your command window, it means you’ve tried to git push to a remote repository from a local branch that has not yet been connected to a remote branch.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |