简体   繁体   中英

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

在此输入图像描述在此输入图像描述

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!

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

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.

您必须选择私钥,而不是公钥。

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.

尝试将ssh://添加到存储库URL前缀,但我怀疑真正的原因是您没有配置私钥(与您应该添加到github帐户的公钥匹配的私钥)进行身份验证。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM