1

Just started a basic Gatsby project by using "gatsby new myproject". Their Git setup seems to be very different from what I'm used to. Once the project installed I created a new GitHub repo, initialized it, added remote, but when I try to push the src I'm getting :

    fatal: The current branch master has no upstream branch.
    To push the current branch and set the remote as upstream, use

         git push --set-upstream origin master

I tried setting the upstream, but it gives me an error and saying "everything is up to date":

Enumerating objects: 51, done.
Counting objects: 100% (51/51), done.
Delta compression using up to 4 threads
Compressing objects: 100% (50/50), done.
Writing objects: 100% (51/51), 408.69 KiB | 4.21 MiB/s, done.
Total 51 (delta 12), reused 0 (delta 0)
error: RPC failed; curl 56 OpenSSL SSL_read: Connection was reset, errno 10054
fatal: the remote end hung up unexpectedly
fatal: the remote end hung up unexpectedly
Everything up-to-date

I even tried re-installing the project, but getting the same issue. Can't seem to find any info in their documentation. Not sure how Gatsby Git is setup and what needs to be done to get it working. I'm not looking to publish the project with gh-pages, just looking to track the source files development for now. Any ideas?

techexpert
  • 2,444
  • 3
  • 20
  • 21
  • 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) – ksav Mar 13 '20 at 07:45
  • There shouldn't be a local git repo after running `gatsby new myproject` – ksav Mar 13 '20 at 08:12
  • @ksav - just replied your answer below – techexpert Mar 13 '20 at 09:30

1 Answers1

1

While running gatsby new myproject uses git to clone gatsby-starter-default into the myproject folder (and then install the dependencies), it doesn't actually create a local git repo for you.

So the workflow you're looking for might be to create a GitHub repo called myproject, then run:

gatsby new myproject
cd myproject

git init
git add .
git commit -m "first commit"
git remote add origin git@github.com:ksav/myproject.git
git push -u origin master
ksav
  • 20,015
  • 6
  • 46
  • 66
  • that's pretty much what I've been doing. Just tried installing another gatsby app 'test1' - the same thing. Whether it clones the repo or creates it - there's definitely a local repo in that folder. If I CD into it and run "git status" it'll tell me I'm on branch master. If I run "git add ." it tells me there's nothing to commit - everything is up to date. Git Add doesn't actually add any files to the commit since there has already been an initial commit from Gatsby.. if I run the commands above - it gives me the same error and never uploads anything. I could probably... – techexpert Mar 13 '20 at 09:23
  • ...delete their repo and try to re-initialise my own, but then I'm not sure if it would break some of their update service.. I think I've read something about that., not quite sure at this point. – techexpert Mar 13 '20 at 09:24
  • Just deleted their repo from the "test1" project. Initialized my own.. still getting the same error. Git works fine with any other folder, just not the gatsby ones.. I'm baffled – techexpert Mar 13 '20 at 09:34
  • `gatsby -v` which version of the cli are you running? – ksav Mar 13 '20 at 11:02
  • Gatsby CLI version: 2.8.30 Gatsby version: 2.19.7 – techexpert Mar 13 '20 at 16:28
  • 1
    got it solved - it was a bug with git of some sorts. Re-installed it and it's working fine now. The weird part was that it worked fine with other folders, just not the gatsby ones. I even tried uploading it to bitbucket and was getting the same errors. Anyways thanks for you help! – techexpert Mar 14 '20 at 02:41
  • Woah. Did you need to reinstall gatsby or reinstall git? – ksav Mar 14 '20 at 03:13