How to connect to github via netbeans? - netbeans

So I'm trying to connect to github via netbeans and uploading a project.
The steps I have taken:
right click project - initialize git repository
right-click project - commit
right-click project - remote - push...
When I am in the push menu:
specify git repository location:
git#github.ugent.be:brosseel/oefen2.git
private/public key:
Users/Username/.ssh/id_rsa.pub
NEXT>>
I get:
Error : Cannot connect to the remote repository at git#github.ugent.be:brosseel/oefen2.git
How to troubleshoot that error message?

It should work if your repo exist first on GitHub (and https://github.ugent.be/brosseel/oefen2.git doesn't seem to exist).
You need to initialize an empty repo of that name, and then try to push form NetBeans.
You also can use the https url:
https://github.ugent.be/brosseel/oefen2.git
And put your GitHub username and password.
But again, that supposes you have created a repo of that name on GitHub prior to trying to push to said repo.

Related

Eclipse git error when pushing to remote: Transport Error: Cannot get remote repository refs

I started a Static Web Project in Eclipse to share the project in a remote Git repository as a backup and to possibly share with others.
Created a git repository in the project's folder C:\workspace\projectname.
Committed (added/staged) everything in the C:\workspace\projectname including the .project file and everything in the C:\workspace\projectname\.settings directory as initial commit (because I thought I want to be able to clone the project again from the repository in the future).
Created a remote repository at rocketgit due to its simpler features and ToS.
After everything had been commited, I right clicked the project's repository in the Git Repository view in Eclipse, clicked Remote -> Push.
I entered https as protocol, rocketgit.com as host, users/username/repositoryname as repository path. Entered my username and password, clicked Next.
But a Problem Occurred dialog shows up, with detail `Transport Error:
Cannot get remote repository refs.
https://rocketgit.com/users/username/repositoryname: https://rocketgit.com/users/username/repositoryname/info/refs?service=git-upload-pack not found`.
How do I resolve this? What does this error mean? Can someone explain a solution. Thanks
users\username\repositoryname as repository path.
"users\username\repositoryname" looks like a path on your disk, not to a remote repo URL.
A proper URL would be https://yourServer/<user>/<reponame>, or ssh://git#yourServer/<user>/<reponame>.
I don't know which one RockertGit does support, but using GitHub, GitLab or BitBucket would work.

Using egit with github and eclipse 3.8.1 on ubuntu 13.10

I am new to eclipse, and I can't figure otu how to set up egit properly to work with github. I made a new local repository, and I've commited some changes, but now I want to get all this code onto github. What should I do? I can't find a solution in the eclipse wiki. I have a github account.
Here is a nice demo that show you step by step video
What you want to do is pulling up repository in eclipse from window -> show view -> other (then find the repository)
After you did that you go to master branch and configure remote then add your SSH key under your github account. Go to your eclipse git destination from remote enter your git account URL, username, password, repository path. All you need to do after that just hit the push.

Push eclipse project to GitHub with EGit

I am successfully pushing my project to GitHub using EGit. My repository is called HelloWorld. My project in eclipse is also called HelloWorld. My problem is when i push the project it is upload the project under the folder HelloWorld. So the result is the repository HelloWorld then the folder HelloWorld and the the src folder. To be more understandable here is the link of the project. I want under the repository HelloWorld to have the src folder. How can I achieve that?
The key lies in when you create the project in eclipse.
First step, you create the Java project in eclipse. Right click on the project and choose Team > Share>Git.
In the Configure Git Repository dialog, ensure that you select the option to create the Repository in the parent folder of the project..
Then you can push to github.
N.B: Eclipse will give you a warning about putting git repositories in your workspace. So when you create your project, set your project directory outside the default workspace.
Simple Steps:
-Open Eclipse.
Select Project which you want to push on github->rightclick.
select Team->share Project->Git->Create repository->finish.(it will ask to login in Git account(popup).
Right click again to Project->Team->commit.
you are done
I use these Simple Steps when I already have committed locally a new project:
Open github.com and sign in and create a new repository.
Copy URL of the new repository.
Open Eclipse.
Select Project which you want to push on github->rightclick.
select Team->share Project->Git-> "push branch '' ...".
Follow the wizard until it finishes.
I have the same issue and solved it by reading this post, while solving it, I hitted a problem: auth failed.
And I finally solved it by using a ssh key way to authorize myself. I found the EGit offical guide very useful and I configured the ssh way successfully by refer to the Eclipse SSH Configuration section in the link provided.
Hope it helps.
If you ever face an authentication issue in any IDE - Eclipse, sts, etc. Simply while creating a remote repository select ssh protocol it won't ask you any username or password. (But will create a file ed25519 on your system which will be having an ssh key). Now you can push or do other activities using IDE without having any authentication issues.
In case of Git bash use command $ssh-keygen (ask for file give proper file path)
suppose you give name as y.pub.
Run the command $cat y.pub
copy the ssh key(starting something as ssh-rsa...) and paste in GitHub(opened in browser your remote repository)
now type command $ssh -t git#github.com
If you get an error while using the above command changed the command to
$ssh-keygen -t ed25519 -c "your userid"
then open the file by using $cat ed25519.pub file
copy the ssh key & paste into Github. Now you are authenticated to perform the various operations.
The other option if you want to use https only is to generate pat(personal access token).go to github-go to settings-go to developer settings-go to personal access token.If you aready had token delete it else click on generate new token.Give anything in note.Click on repo (you can select multiple options too) click generate token.Copy the token and now in your ide instead of password use the token.I hope it will solve your problem.

Can't push using EGit and Bitbucket

I've been trying to start a project using EGit with Bitbucket but I can't push the project to the repository in the server.
These are the steps I've followed (I'll try to be very specific so other people can use it as a tutorial mode; even though it's not working for me it might work for others):
1) I installed Git on Ubuntu 12.10 using this tutorial
2) Followed this tutorial for GitHub.
Start a new C++ project in Eclipse
Under Window > Preferences > General > Network Connection > SSH2 > Key Management tab, I generated a new RSA key and added it to the list of deployment keys of my repository on Bitbucket.
Right click on the eclipse project: Team > Share project ; Team > Add to index ; Team > Commit
Window > Show View > Other > Git > Git Repositories
Right click on Remotes > Create Remote > Checked "Configure push" and typed my project's name
Add Push URL: ssh://git#bitbucket.org/myuser/myrepository.git, Protocol: ssh; port: blank; user: git; password: blank
Advanced button under Ref mappings and selected the "master" version. If this step works, it means that the RSA key is configured in Bitbucket and EGit properly. Otherwise it will show a connection error.
Everything is done. However, when I press "Push" I get the following error:
ssh://git#bitbucket.org/myuser/myrepository.git: push not permitted
I've tried every configuration possible: switched to a new work space, updated Eclipse, created new repositories, re-installed Git... Any ideas?
Alright, I've finally found a way to work with it.
It's just changing the authentication mode. If the HTTPS link is used, instead of using the SSH link, everything works perfectly. It seems that SSH works just in a read-only mode.
Of course the authentication method is different: you have to type the password and the SSH keys stored in Bitbucket are no longer necessary.
For those who are having problems with EGit, I recommend following eugener's way to automatically configure EGit. Then you just have to select HTTPS as authentication mode to push the stored commits.
There is much simpler way of configuring remote Git repos in Eclipse:
Create an empty repo on BitBicket
Copy repo's URL
Clone repo to your machine using "Git Repositories" view.
Share your project into newly cloned repo.
Since a repo was cloned - remote settings were configured automatically. This means you will be able to push immediately
It might be a user name misconfiguration in .gitconfig.
Probably related, I fixed "auth fail" problems by following the instructions on:
http://wangpidong.blogspot.com.es/2012/05/how-to-use-bitbucket-with-egit-in.html
Got it from:
Configuring egit with BitBucket
In this specific case I agree with resolution from Olivier J.'s comment under original question.
But I have had similar problem and it was caused by something else. I resolved it and here is what happened:
I have been using some private repository at Bitbucket (A) with some user account and some public key (X) to access it. I have had key X loaded in my pageant Putty key chain.
Then I created a new public repository (B), also at Bitbucket with a different user account and another public key (Y). I added this key to pageant too.
When I tried to access repository B apparently public key X and not Y was used, because ..for SSH client both connections are the same - same user (git) at the same host (bitbucket.org)! And key X was used first because ..it was loaded earier? Or maybe because its name was alphabetically first? I am not sure but the result was that...
Read-only access for B using X was granted because the repository was public and any valid Bitbucket user key was enough to gain this kind of access!
..but writing (pushing) required key Y, which was not used by SSH.
So the general tip is: to resolve strange read-only git via SSH access errors check carefully which private key is actually used by SSH.
I resolved this problem by loading only one key - X or Y - in pageant at a time but I would love to do it a smarter way - please let me know in comments if you know how!
Using Bitbucket I do it this way:
create a repository in bitbucket
clone the empty repository using the https url
connect the project in eclipse to the repository using the Team -> Share option and select the location where you cloned the repo
index (stage) your project files
commit and push

Need some help setting up Git/EGit/GitHub for the first time

I am creating a totally new OSS project for my organisation and I want to host it on GitHub. The project will be developed using Eclipse and I am using EGit. I have no prior experience with Git, as I've previously only used SVN.
Here's what I did so far:
Created a new account for my organisation on GitHub. (I already had a personal account.)
Created a new repository under my organisation's GitHub account for this project.
Under the new repository's "Collaborators" section, added my personal account. (I verified this in my personal account.)
Installed EGit into my Eclipse. (I am using Eclipse 4.2 with EGit 2.0.0)
Created a new Eclipse project in a new Eclipse workspace. (It's a Maven project so I created it through m2e but that shouldn't make a difference.)
Added the new Eclipse project to a new Git local repository (via Team -> Share Project).
Created the .gitignore (ignores Eclipse-specific files and directories).
Added source to the project (via Team -> Add to Index).
Committed local changes to my local repository.
Copied the HTTPS URL from GitHub.
Team -> Remote -> Push
The URL from the clipboard was already taken and most fields populated.
Entered username and password for my GitHub personal account, clicked Next, data was fetched successfully.
Selected "refs/head/master" from the Source ref dropdown (I didn't understand this entire page, maybe I've put something wrong?)
Clicked "Add Spec" and then Next
At this point, I got the error "master: master [rejected - non-fast-forward]"
I searched on Google, but the suggested resolution was to do a Pull. I tried "Team -> Pull", but got the error "The current branch is not configured for pull; No value for key branch.master.merge found in configuration"
Can anyone help me? My remote repo is still empty (save for the .gitignore and the README.md). I want to get files from my local into that remote repo!!
That looks like there is already committed content in your Github repository. I don't exactly know what is going wrong, but I would do it different:
First install Mylyn and the Mylyn GitHub connector in Eclipse. That way you can access github repositories much easier.
Use the Mylyn Github connector to clone your existing (assumed to be empty) Github repository into a new local repository (File->Import->Git->From Github). That is the easiest way to verify your login credentials, ssh keys and so on.
During the previous cloning step, the github repository was automatically added as "upstream" repository reference to your local repository. So if you now add files to your local repository, you can commit them and afterwards use "Push to upstream" to make them available on Github. No configuration of the remotes and refspecs is necessary in that case.
Now create your new Eclipse project and share it using the Team -> Share, where you select your existing local repository.
Everything beyond that would be as you already described.