Zend Studio & GitHub can pull from repository but not push - github

I followed directions from this page. Everyting seems to work.
So in short what I did.
Created a repository in GitHub called 'myrepository'
Imported the repository successfully into Zend framework.
In Zend Studio went to preferences -> general -> network connections -> ssh2 -> key management -> Generate SSH key. I then copied and pasted the key into my account on github.
If I create a file in GitHub and go back to Zend Framework to pull it in, it actually works. If I do it the other way around though creating a file in ZF and then trying to push it, it doesn't show up in my repository in GitHub. Can't figure out why.

I didn't realise I needed to create a local repository first in order to properly set up ZS with EGit.
I Followed the tutorial on the EGit gettting started page, and then went back to the instructions on EGit with GitHub instructions. This made Nils Werner's comment make sense where you simply choose the connection method on your GitHub account and configure EGit accordingly.

Well, those instructions use the https method while you are trying to set up the ssh method...
You either don't need to set up your ssh keys or you need to use the git#github.com... URL.

Related

Is it possible to create github repository for my project in Visual Studio Code?

Is it possible to create github repository for my project in Visual Studio Code,
and commit all the files?
I have not found a single example where a repository is created from VSCode.
Now, there is also a "Publish to Github" button in the "Source Control" part, when there is no git repository, to directly create a repository on github.
If you click on it, by default, VSCode propose (in the main bar) to create a private or a public repository with the project's folder name.
Just make a new file in VS Code. Local file created in VSCode
Go to Source Control. You will have an option to Initialize Repository, which inturn creates a repo in Github.
Note : You need to connect to your github account before hand.
There is documentation on this page on how to initialize a repository in vsCode: https://code.visualstudio.com/docs/editor/versioncontrol
EDIT:
Another link that should be helpful: https://code.visualstudio.com/docs/introvideos/versioncontrol
Use GitHub API to create repo. Outside of the API, there's no way to create a repo on GitHub via the command line.
curl -u 'username' https://api.github.com/user/repos -d '{"name":"projectname","description":"project desc"}'
git remote add origin git#github.com:nyeates/projectname.git
As far as I can tell, it's currently not possible with a default installation of VS Code. But you can make it work like this:
Add the REST API client by Huachao Mao to VS Code (others may work, haven't tested).
Create a personal access token in GitHub.
Create a new temporary file and enter the following text:
curl -u 'myGitHubUsername:myToken' "https://api.github.com/user/repos" -d '{"name":"MyNewRepo","description":"Repo Description"}'
Then select the line, press F1, look for "REST" in the search field and run the command "Rest Client: Send request"
After a short while you should be able to add the new remote repo using onboard tools.
Obviously, this is too elaborate for a one-time use. But once it's all set up, it's quite easy to create new repos or interact with the GitHub API in other ways.

In SourceTree is it possible to use both GitHub and Bitbucket with one instance?

SourceTree appears to be a decent GUI frontend to both Git and Hg and I'd like to use it as my client for both Bitbucket and Github.
However, on initial setup it offers only to add one of them and later on in the settings one can only edit the existing entries but not add new ones.
Is there a way to use SourceTree against both Github and Bitbucket at the same time?
I am using SourceTree 1.6.12.0.
Yes I use for both. I think I used github first. Then later I added a new repo, selected clone from url and gave it a bitbucket url. Works fine.

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

How to set up Netbeans, Mercurial and BitBucket with SSH

I set up Mercurial (actually TortoiseHg) to work so that Netbeans could interact with BitBucket. I set it up with HTTPS, but now I'm trying to use SSH instead. I'm not having much success. Here are the steps I took:
First, I opened PuTTYgen and generated an SSH2-RSA key. I wrote my email - the same one I used to register on BB, I don't know if that matters - as the Key comment. Anyway, I uploaded the public key to BitBucket and it accepted it.
Then I created a private key and added it with pageant, as this page instructs. After that I made a command from the command line to verify it worked:
hg clone ssh://hg#bitbucket.org/myaccount/myrepo
It worked - cloned the entire repo to my computer. But then I went over to Netbeans and right-clicked on my project and went to Mercurial > Properties.... I filled out the box like this:
default-push: ssh://hg#bitbucket.org/myaccount/myrepo
default-pull: ssh://hg#bitbucket.org/myaccount/myrepo
username: My Name <my#email.com>
I tried to push/pull my repo, but it didn't do anything. I'm using Netbeans 7.0.1. How do I fix this?
You can setup your repo as https. I already tried and it works.
default-push: https://hg#bitbucket.org/myaccount/myrepo
default-pull: https://hg#bitbucket.org/myaccount/myrepo
username: My Name <my#email.com>
You will need to setup the SSH link in the hgrc file for the repository or the one that is used by Netbeans.
Details can be seen here, how it can be setup: http://wiki.netbeans.org/FaqHgSSH

github Committing

I have got github ssh details to get the client project, i never worked on github before. So sorry for this stupid question. I Have ssh keys(public,private which was generated under filezila from my system - ubuntu 10.04) and client has added those keys into his repos. And he has given commiting url from github to my system.
I have installed and made a test project under my account in github with the ubuntu system. But not able to commit the client work.
His url is somthing like this,
ssh://git#domain.com:/home/git/project.git
how can i commit this project files,
i guess i have to add those ssh private,public keys under this github installation but i dont know how to add. Please help me.
Add an SSH key to your github account, see their help page for more information. Make sure to test that it's been set up properly.
Ask your friend to add you as a collaborator to the project: Project page -> Admin -> Collaborators.
Clone the repo at home and have fun committing! The URL will look something like this:
git#github.com:USERNAME/PROJECTNAME.git
So example on linux:
git clone git#github.com:USERNAME/PROJECTNAME.git