0

i have a branch name salil_dev in my current repository. i want to push code on this branch and when i am running command: git push --set-upstream origin salil_dev I got error of

fatal: The current branch salil_dev has no upstream branch.

I checked my login credentials and all are upto date, but still am facing this problem. Please correct me where am doing wrong.

sahil
  • 123
  • 10
  • I posted a few suggestions below. Please let me know if this solves your problem. If not, we can keep digging. – DV82XL Aug 23 '20 at 16:02
  • Is this a brand new repo you're setting up? Are you pushing to gitlab or github? – DV82XL Aug 23 '20 at 16:42
  • no it's not a brand new repo, and I am pushing to github – sahil Aug 23 '20 at 16:48
  • Can you please update your question with the response from `git remote -v`? Only keep the relevant lines that relate to `salil_dev` and `master`. Also, in GitHub, can you see all your files in the master branch? In the branches drop-down menu, do you see `salil_dev`? – DV82XL Aug 23 '20 at 16:58
  • i can't put the name of my current repo on here due to some reasons. But i recently create a new repo and trying to put some other random code, and again i got the same issue. – sahil Aug 23 '20 at 17:04
  • You can hide the name of the repo. I just want to make sure there is an origin remote defined with (push). – DV82XL Aug 23 '20 at 17:09

1 Answers1

0

A few things come to mind:

  1. Make sure you are checked in to your local salil_dev branch when you run this command
  2. If this is a new branch and you don't need to change the upstream branch, just call git push origin salil_dev
  3. Is this a new repo? If so try calling git remote add origin url-to-your-repo to add a new remote to your repo.

If that doesn't work, try this:

  1. origin is the default remote name, but it may be different. Run git remote -v to show a list of all remotes and make sure origin is in the list with (push) listed next to origin.
  2. If this is a new repo, first run git push -u origin master (with local master checked out), followed by the push to your feature branch (with that branch checked out). See this answer for more details.
  3. You tagged your question with github and gitlab. Make sure you're pushing your commit to the correct repo.
  4. If you're using https, check out this answer for additional suggestions related to authentication issues.
DV82XL
  • 2,189
  • 1
  • 13
  • 29
  • 1
    yes, I have checked into the salil_dev branch before run this command. I also run git push origin salil_dev but still got the same error. When I run git remote add origin url-to-your-repo command then I got fatal: remote origin already exists. The issue is still the same. – sahil Aug 23 '20 at 16:07
  • yes, I tried everything which you mentioned in your edited answer, but still, the issue is the same. – sahil Aug 23 '20 at 16:37