12

I am very new to Github. I just created one github account and it says as bellow:

Step 1)

Global setup:
 Set up git
  git config --global user.name "MyName"
  git config --global user.email MyName@gmail.com

Next steps:
  mkdir Java
  cd Java
  git init
  touch README
  git add README
  git commit -m 'first commit'
  git remote add origin git@github.com:MyName/Java.git
  git push -u origin master

Existing Git Repo?
  cd existing_git_repo
  git remote add origin git@github.com:MyName/Java.git
  git push -u origin master

Step 2) NetBeans IDE trying to setup the link as git@github.com:MyName/Java.git

enter image description here enter image description here

Now it gives error as you can see above. How do i setup this?

Follow up: (above process did not worked)

$ create a project > cd /var/tmp/newproject
$ sudo git remote add origin git@github.com:me/newproject.git
$ ls -a
.  ..  build  build.xml  dist  .git  .gitignore  manifest.mf  nbproject  src

$ Open netbeans 
  > Automatically it detects 
  > origin:git@github.com:me/newproject.git 
    > press next 
      > local branch 
        > select master 
          > press next 
            > press finish
  Works!

6 Answers6

14

Github setup is so easy with netbeans IDE. Follow the steps..

1 - Go github and create a repository, and copy URL like https://github.com/akatkar/....

2 - Open Netbeans IDE. If GIT plugin is not installed, install from tools/plugin

3 - From Netbeans Team menu click clone

4 - Paste your URL as repository URL, provide your github user name and password

5 - Netbeans IDE will clone your repository and will ask to create a new application

6 - Create an application and copy or create your source files in this application

7 - Commit changes and push to the remote

8 - DONE. Check from github your changes and enjoy...

Ali Katkar
  • 517
  • 4
  • 7
9

Open your terminal, enter your project root fold, and add your remote:

$ cd path/to/your/projcet
$ git remote add origin git@github.com:me/java.git

I think it should detect your setting, then check how your IDE set your github repository.

Kjuly
  • 34,476
  • 22
  • 104
  • 118
0

You have to select the private key, not the public one.

Iván
  • 9
  • 1
0

For anyone at this page with similar issues common problems with netbeans ide:

If you have two factor authentication switched on in your github security settings netbeans can not handle this. If you use git bash cli it will popup with a login box and two factor code entry.

Also check your config file in the .git/ folder as netbeans can change git@github to [yourusername]@github.com in the url path which you can edit in this config file back to git@github.com.

These changes should allow you to push to a remote repository.

SpenceUK
  • 1
  • 4
0

As of Friday the 13th in August 2021, github changed some of the authentication rules. This can foul up IDEs. Update your installed version of git if you haven't already.

Test for authentication problems by opening a command prompt, changing to the directory with your repository (it has a hidden '.git' directory), and attempting to manually push as described in the help from the original post: git push -u origin master. If there is an authentication issue, you should see a GUI prompting for credentials.

trindflo
  • 311
  • 3
  • 12
0

Try prefixing ssh:// to the repository url, but I suspect the real reason is that you have not configured the private key (the one that matches the public key which you should have added to your github account) for authentication.

prusswan
  • 6,853
  • 4
  • 40
  • 61
  • I applied that please see above screen shot. Still the same! –  Dec 10 '11 at 11:29
  • 1
    Is java.key.pub the public key? There should be a java.key or java.key.pri and that is the private key – prusswan Dec 10 '11 at 11:58
  • Yes i tried both file java.key and also with java.key.pub. But still same. –  Dec 10 '11 at 12:32
  • 1
    To determine if this is a Netbeans or git issue, copy your private key file to ~/.ssh/id_rsa (if it's not already there), then do a `ssh -v git@github.com` at the terminal and post the results in your question – prusswan Dec 10 '11 at 12:50
  • See my edit above, i like simplicity way to manage the git. It is already too much complicated because of manual settings. But now its easy as mentioned above. –  Dec 10 '11 at 13:01
  • 1
    The cause of your problem is that your username is different from your system login. That's why git remote add is needed to add those entries (manual settings) to ~/.ssh/config. You can verify that using ssh -v – prusswan Dec 10 '11 at 13:08