-1

Any info I have found in similar threads could not help me solve the problem.

Basically, I am working on a git project. My usual way of working have been:

git checkout -b new_branch   #Create a new branch

I program in Julia programming language, using the Juno IDE within Atom. I have a Julia package in the "dev" folder (for those into Julia developing). I make a couple of changes to the code. Atom/Juno lets me commit them. When I am done I go to gt and write

git push git_user_name origin

This is the routine someone told me, and while I am not very familiar with git it has kinda always worked out. Until now, when I got this back:

error: src refspec origin does not match any.
error: failed to push some refs to 'git@github.com:JuliaPackage/JuliaSubPackage.jl.git'

Only a week ago or so I did all this and it worked out. But now I get this error. Lots of online help threads seem to suggest that an initial commit is missing, but I have made several commits here.

Does anyone have any suggestions on what might be going on?

Mugur 'Bud' Chirica
  • 4,246
  • 1
  • 31
  • 34
Gaussia
  • 113
  • 1
  • 2
  • 8
  • `git push username origin` is almost certainly wrong. What's probably right is `git push origin new_branch`. – torek Feb 23 '19 at 03:16

2 Answers2

0

You probably didn't commit anything, try this:

git add *
git commit -m "my commit" 
git push origin git_user_name //instead of git_user_name origin

Alternatively do a git show-ref, if you want to see all your refs. Then you can do a git push origin HEAD:<your_branch>.

If this works you probably created a branch before pushing into master.

Secko
  • 7,664
  • 5
  • 31
  • 37
0

Let me add some more Julia specific comments about a typical workflow (and assumes standard configuration of your git repository).

  1. In Julia in package manager mode you write dev YourPackage
  2. You go to .julia/dev/YourPackage folder
  3. run a command git remote -v; make sure that you have the right to push to the origin (this might not true if you are trying to contribute to a package created by someone else who did not give you write rights to the repository)
  4. run git checkout -b your_branch
  5. Make your changes to the code
  6. run test YourPackage in the package manager mode (so that you are sure that your changes pass the tests defined in the package)
  7. commit the changes using git add and git commit
  8. Run git push --set-upstream origin your_branch (this will fail if you do not have right to push to origin - see step 3. above); if the branch was created earlier on the remote and you just want to add some commits to it it is enough to just write git push
  9. When you are happy with the changes and done with the development of the functionality then most likely you will want to:
    • squash merge the commits you made in your branch to master branch in the origin
    • optionally you can make a release of the package (then when you leave dev mode the package version including your changes will be available)
    • delete your_branch locally and in the origin
    • update master locally with the master from the origin
Bogumił Kamiński
  • 66,844
  • 3
  • 80
  • 107
  • This worked!Not really sure how, but the "git push --set-upstream origin your_branch" seemed to do the trick. Thanks – Gaussia Feb 24 '19 at 18:33