Rayjax
Rayjax

Reputation: 7784

How to push to github from netbeans without local branch

I have received a github project url from a friend of mine who gave me r/w access to his repo. I downloaded the stuff with the "download as zip" button on github, worked on the project, but now when in neatbeans i do right click/remote/push, i enter repo informations, then it asks me to choose a local branch which i don't have because I downloaded manually the files.

So I created a local branch with the same name of the only branch of the project I can see on github, but when I do "push", nothing changes on the repo. My versions simply don't get uploaded.

Any clue ? I am new to git so sorry if I ask something which may seem obvious. THanks

Upvotes: 2

Views: 11843

Answers (2)

OMGtechy
OMGtechy

Reputation: 8220

I have had this problem myself.

The solution I found was to make changes to the code, commit the changes and then push.

In short:

  1. Make changes to the code
  2. Commit changes (under team menu)
  3. Push changes (under team->remote)

Hope this helps!

Upvotes: 6

mr.VVoo
mr.VVoo

Reputation: 2270

You can try the following:

  1. Backup your changes.
  2. (assuming git is installed correctly) checkout the project from GitHub using git clone <url> (now you should be on a master branch. if there is only one branch that doesn't matter, if there are other branches be sure to use the right one with git checkout)
  3. Then try to copy your changes (files from backup) on top of the files retrieved by git clone.
  4. within the repo's root directory run git status and check if there are files need to be staged to the index (git add)
  5. if everything is staged to the index run git commit -a -m "some message"
  6. finally run git push

Using GitHub you maybe require a ssh key or use the HTTP connection. BUT this is of course a bad solution because you treat the idea of SCM with contempt. In the future you should first connect to a repository, make your changes commit and push them. Only then you are able to do fine-grained commits and revert them if something was wrong. Commiting a large set of changes is not the right way!

Upvotes: 3

Related Questions