git 如何在我的 NetBeans IDE 中设置 github 存储库?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8456032/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to setup github repository in my NetBeans IDE?
提问by Ali Katkar
I am very new to Github. I just created one github account and it says as bellow:
我对 Github 很陌生。我刚刚创建了一个 github 帐户,它说如下:
Step 1)
第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
步骤 2) NetBeans IDE 尝试将链接设置为 [email protected]: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 [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!
采纳答案by Kjuly
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
$ 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.
我认为它应该检测您的设置,然后检查您的 IDE 如何设置您的 github 存储库。
回答by Ali Katkar
Github setup is so easy with netbeans IDE. Follow the steps..
使用 netbeans IDE 设置 Github 非常简单。按照步骤..
1 - Go github and create a repository, and copy URL like https://github.com/akatkar/....
1 - 去 github 并创建一个存储库,然后复制 URL,如https://github.com/akatkar/....
2 - Open Netbeans IDE. If GIT plugin is not installed, install from tools/plugin
2 - 打开 Netbeans IDE。如果未安装 GIT 插件,请从工具/插件安装
3 - From Netbeans Team menu click clone
3 - 从 Netbeans Team 菜单中单击克隆
4 - Paste your URL as repository URL, provide your github user name and password
4 - 将您的 URL 粘贴为存储库 URL,提供您的 github 用户名和密码
5 - Netbeans IDE will clone your repository and will ask to create a new application
5 - Netbeans IDE 将克隆您的存储库并要求创建一个新应用程序
6 - Create an application and copy or create your source files in this application
6 - 创建应用程序并在此应用程序中复制或创建源文件
7 - Commit changes and push to the remote
7 - 提交更改并推送到远程
8 - DONE. Check from github your changes and enjoy...
8 - 完成。从 github 检查您的更改并享受...
回答by SpenceUK
For anyone at this page with similar issues common problems with netbeans ide:
对于此页面上有类似问题的任何人,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.
如果您在 github 安全设置中启用了两因素身份验证,则 netbeans 无法处理此问题。如果您使用 git bash cli,它将弹出一个登录框和两个因素代码条目。
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].
还要检查 .git/ 文件夹中的配置文件,因为 netbeans 可以在 url 路径中将 git@github 更改为 [yourusername]@github.com,您可以在此配置文件中将其编辑回 [email protected]。
These changes should allow you to push to a remote repository.
这些更改应该允许您推送到远程存储库。
回答by Iván
You have to select the private key, not the public one.
您必须选择私钥,而不是公钥。
回答by prusswan
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.
尝试在存储库 url 前添加 ssh:// 前缀,但我怀疑真正的原因是您尚未配置私钥(与您应该添加到 github 帐户的公钥匹配的私钥)进行身份验证。