Can't push to git hub - ruby-on-rails

I just completed Chapter One of the Ruby on Rails Tutorial by Hartl. Posted about one minor hitch previously. Now I started Chapter Two. I swear I did everything by the book, but now when I try:
git push -u origin master
I get the following messages after entering my passphrase:
ERROR: repository not found
fatal: could not read from remote repository
Please make sure you have the correct access rights and that the repository exists.
When I down loaded heroku tools I think it installed a second version of Ruby on my machine. In any case I now have two version listed under All Programs. Could this have screwed thing up? The two versions are Ruby 1.9.2-p290 and 1.9.3-p327. Also when I open the command prompt using 1.9.2 there is a weird thing at the top before I do anything:
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
This is then followed by the normal prompt on the next line. I'm wondering if the use of my public keys have some how gotten screwed up.
Any help would be appreciated.

You should add a new git remote.
check https://help.github.com/articles/adding-a-remote

So i had problems with windows and multiple versions of ruby too. I would recommend deinstalling all versions and only installing one ruby version. But thats not related to your Github problem i guess.
Switch via the commandline to your app folder and checkout:
git remote -v
it shows you what is the remote location for you app. And 5 bucks that its screwd up. You can remove the path by:
git remote rm origin
or if its only on heroku:
git remote rm heroku
and after that add the correct remote path again. Example:
git remote add origin git#github.com:foo/bar.git
That hopefuly fix it.
And keep in mind if you want to push to heroku use:
git push heroku master

Related

Please make sure you have the correct access right and the repository exists github

When I try to push my changes to my github repo I am receiving the error:
Fatal: 'git#github.comRedHoodJT1988/hello_app.git' does not appear to be a git repository
Fatal: could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
I have looked at the documentation and completed the steps here:https://help.github.com/articles/error-permission-denied-publickey/
As well as looked at other sites and nothing is working. I am able to connect to ssh because I receive the message :Hi RedHoodJT1988...
I am at a loss for what to do next. I am not using a cloud IDE I am on a macbook pro if that helps. Also, not sure if it matters, I am developing a Ruby on Rails application.
You're missing a colon in your address and need to change your remote named origin
git remote remove origin
git remote add origin https://github.com/RedHoodJT1988/hello_app.git
Since it is an SSH URL, there should not be any https involved:
git remote set-url origin git#github.com:RedHoodJT1988/hello_app.git

Remote Git repository unreachable in XCode 5

I have created a remote Git repository for a new project. I have added to my remotes and XCode recognizes it. When creating the new project, I checked the box for Source Control > create git repository on: and selected "Add to New Server"
When I enter my login credentials, I get the following message:
The server https://... is unavailable or may not exist. Check the server address, check your network connection, and then try again.
I have verified that my login is correct and the url is definitely valid. What might I be doing wrong?
Thanks!
Was able to solve my issue using the following:
git remote add origin git#github.com:pheepster/<repoName>.git
git push origin master:master
with the help of: https://stackoverflow.com/a/14470400/2115842
In addition to the two git commands in #Pheepster's answer, I suggest you check you are running the current version of GIT on both the development Mac and Server. Once I had the current version of GIT on both systems the two lines above solved my issue.

Preparing an Installation and Installing on client machine

As I have done my first project on Ruby on Rails.
I want to know what should I do to prepare installation from my machine the code i generated in a project and other thing is that what should I do to install that all on client machine the I prepare from my machine.
You should probably put your code in a repository - probably git via GitHub is best. If the setup is going to be different then perhaps gitignore the database.yml but include a .sample of it. Then to install on someone's machine just checkout the repo bundle install and run the relevant rake tasks (db:setup probably).
Updates can then be applied by pulling from the repo.
Other than that zip it up and unzip on there machine making sure to install everything required.

Cannot commit - messed up my sourceCode control, how to fix it?

Hello fellow programmers,
I accidentally added my whole project to my project, not once, but twice, as I was looking for another functionality. Since the folders didn't show up in Xcode itself, I went to Finder and deleted them manually from the filesystem again (so far so good, since I got all warning 4x).
But now, when I want to commit changes to the sourceCode control, I get this error:
fatal: Could not switch to '/Users/myID/Developer/iOS/ProjectName/ProjectName/ProjectName': No such file or directory
I have pretty much no clue what to do, has anyone ever had such a problem? Cleaning the project does not help, that's all I could think off, as I'm not that experienced!
Help I HIGHLY appreciated!
PS: I'm running Xcode 4.3.2 on OSX 10.7.4
For something as serious as this I would create a new git repo, starting from the commit revision before the screw-up.
Assume your code is in ~/Source/MyProject.
First you are going to need the commit revision before the screw-up. You can get his from the command line using git log or better still you can use the excellent (and free) SourceTree Mac App. Lets assume it's 62a6614fb55d692cd5a6e251cc05dea45d9668fe.
Next start a new repo: $ mkdir ~/Source/MyProjectNew; cd ~/Source/MyProject/New; git init.
Add the old project as the 'remote origin' of the new project: $ git remote add origin ~/Source/MyProject.
Fetch the pre-screwed code: $ git fetch origin 62a6614fb55d692cd5a6e251cc05dea45d9668fe.
Reset the master branch to the pre-screwed commit: $ git reset --hard FETCH_HEAD.
Remove the origin: $ git remote rm origin.
You now have a new repo without the screwed-up code. You need to rename the old and new repo and carry on with your life.

Git push fails to github: failed to read object

The story:
I've been developing a RoR-app in both my desktop and laptop. It was quite handy to commit changes made on another, push them to github and fetch & merge on other.
The starting point is this: I committed latest changes on my desktop, pushed them to github and then fetched and merged them into my laptop. Then, I made some commits on laptop and pushed to github. Took the changes, merged to my desktop (with --no-ff). THEN, happened the probable source of all mischiefs: I reverted the desktop to commit where it was before the latest fetch & merge. Made some development work with it, committed, pushed to github. In the laptop, I did the revert as well, though I reverted it to a commit which was made somewhere between the latest fetch from github, fetched again and merged those. Some error messages came after reverting desktop and laptop both, but things worked still fairly well and I kept working on both machines.
Until now. I tried to push from my laptop to github, which gives the following output:
Counting objects: 106, done.
error: unable to find 5a2a4ac...
error: unable to find bc36923...
error: unable to find ecb0d86...
error: unable to find f76d194...
error: unable to find f899df7...
Compressing objects: 100% (64/64), done.
fatal: failed to read object 5a2a4ac... : Invalid argument
error: failed to push some refs to 'git#github:username/repo.git'
So, the question is, what exactly took place here?
EDIT: It seems that because of suspending my laptop and moving it from place to place in that state screwed up the hard drive somehow. The fsck output is unavailable because we worked around the problem and kept on working, but IIRC some branches and commits were dangling, including that commit which git failed to read. - Teemu
I have run into these kinds of issues.
Rather than spending hours trying to resolve and fix these issues, my 'solution' is usually to take the code I want, copy it into a new directory, delete the .git files and then create a new github for it and then connect the two as usual.
Although this may not be a specific answer to the details you raise, I find that there can be a number of ways that git/github issues can happen and rather than wishing I was a 'git expert' now (it's happening but it takes time), I do the above and continue with my actual application development.
The problem you have is that you are trying to read objects that are not part of your 'tree'. They exist but they have been orphaned. However, git allows you to merge one project to another so this is one way you can keep your commits without starting again, something like the following:
git remote add -f somename git://somegitplace.com/user/some.git
git merge -s ours --no-commit somename/master
git read-tree --prefix=ext/somename -u somename/master
git commit -m 'external merge'
git pull -s subtree somename master
Hope that helps. Let me know if not and we can attack it again

Resources