user285594
user285594

Reputation:

How to setup github repository in my NetBeans IDE?

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 [email protected]

Next steps:
  mkdir Java
  cd Java
  git init
  touch README
  git add README
  git commit -m 'first commit'
  git remote add origin [email protected]:MyName/Java.git
  git push -u origin master

Existing Git Repo?
  cd existing_git_repo
  git remote add origin [email protected]:MyName/Java.git
  git push -u origin master

Step 2) NetBeans IDE trying to setup the link as [email protected]: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 [email protected]:me/newproject.git
$ ls -a
.  ..  build  build.xml  dist  .git  .gitignore  manifest.mf  nbproject  src

$ Open netbeans 
  > Automatically it detects 
  > origin:[email protected]:me/newproject.git 
    > press next 
      > local branch 
        > select master 
          > press next 
            > press finish
  Works!

Upvotes: 12

Views: 61870

Answers (6)

trindflo
trindflo

Reputation: 349

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.

Upvotes: 0

SpenceUK
SpenceUK

Reputation: 11

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 [email protected].

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

Upvotes: 1

Ali Katkar
Ali Katkar

Reputation: 557

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...

Upvotes: 14

Iván
Iván

Reputation: 9

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

Upvotes: 0

Kjuly
Kjuly

Reputation: 35131

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

$ cd path/to/your/projcet
$ git remote add origin [email protected]:me/java.git

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

Upvotes: 9

prusswan
prusswan

Reputation: 7101

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.

Upvotes: 0

Related Questions