0

Hi I am using VS Code and I use the terminal setting on there to push onto github. For some reason its giving me this error:

enter image description here

here is the link to the repo: https://github.com/Kazim786/node_work The repo is public, and the master is default as well.

Kazim Shabbir
  • 145
  • 1
  • 12
  • 3
    Does this answer your question? [fatal: The current branch master has no upstream branch](https://stackoverflow.com/questions/23401652/fatal-the-current-branch-master-has-no-upstream-branch) – Edward Romero Aug 31 '20 at 18:11
  • What happen if you follow suggestion made by git command? – rkosegi Aug 31 '20 at 18:20
  • @EdwardRomero Thanks for responding! To be honest, Im trying to follow the instructions there but I dont think I am doing it correctly. I did: git add . git commit -m "message" git push -u origin head. And it didnt work. Can you see what I am doing wrong? – Kazim Shabbir Aug 31 '20 at 18:32
  • @rkosegi Nothing happened to be honest – Kazim Shabbir Aug 31 '20 at 18:33
  • how did you clone your repo? is your repo public or private? Is your master branch setup as default or did you add restrictions. It would be good to get your question updated with this information so that we can better help. It's hard to say if issue is permissions within branch, token, messed up git history, without understand where you are at in the process – Edward Romero Aug 31 '20 at 18:36
  • @EdwardRomero The repo is public, and the master is default as well. I will update it in the question too. Thanks! – Kazim Shabbir Aug 31 '20 at 18:50
  • @EdwardRomero were you able to figure it out? – Kazim Shabbir Aug 31 '20 at 19:02
  • @KazimShabbir I provided you with a bunch of resources that i think you should familiarize yourself with. It goes through the process of setting up your github repo, setting up local ssh credentials, cloning, ...etc. Check it out and let me know if you have any more questions, and I'll be happy to update the answer until we have something that we can share for anyone in your current situation – Edward Romero Aug 31 '20 at 19:08

2 Answers2

0

You will have to mention the upstream to which you would like to push the code. In this case since you want to push your code to the master branch and the origin upstream, you can use the command:

git push origin master

techpool
  • 61
  • 1
  • 5
  • I am getting this: ERROR: Repository not found. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. – Kazim Shabbir Aug 31 '20 at 18:35
0

Ok let's just give you some resources to follow so that you can get unstuck. I think it's best to provide a list of resources than trying to cover each single step that has been shared in the past in many different places. Hopefully this helps people that are just getting started with their github repos.

  1. Make sure your local is setup properly https://kbroman.org/github_tutorial/pages/first_time.html

  2. How to clone your repo so that it works properly with your ssh git user setup on #1 https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository#cloning-a-repository-using-the-command-line

  3. Add your changes and push. Follow #4 to deal with branching which is what workflows due.

     git add . 
    
     git commit -m "<comment>"
    
     git push origin master
    

    The push can be to whatever your remote branch is so follow the below to sources to get a better understanding of the workflows

Here is info on commits from github itself https://docs.github.com/en/github/using-git/pushing-commits-to-a-remote-repository

  1. Git branching workflow - has a lot of good info on different way of handling branches with git https://gist.github.com/blackfalcon/8428401
Edward Romero
  • 2,905
  • 1
  • 5
  • 17