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
Related
Since a few days ago, I've been experiencing a repetitive crash on Xcode every 3-8 minutes.
The only tangible thing I can find in the crash logs is that it always shows:
Crashed Thread: Dispatch queue: DVTSourceControlGitXPCClient :: Proxy Completion Queue
It seems to be Source Control related, but I wonder how?
I will add everything related to my current project in case it is relevant:
Xcode 14.2 (14C18)
Using Source Control with GitHub
Swift targets iOS and macOS
SPM
It seems like some folks are experiencing a similar issue, as seen on the Developer Forums
Any leads as to why or how to solve it?
After some struggling I decided to check how was git doing, directly from the Terminal.
It turns out there were some things that didn't make sense, specifically a file I deleted from my project but then added again, was showing as modified, even though I had already committed all changes for that file a few days ago; but I had done it directly from Xcode Source Control.
From the Terminal, I staged all changes and committed them. Since then Xcode hasn't crashed for a few hours yet.
My limited understanding of the problem points out that Xcode had issues staging those changes I made a few days ago, and since then the repository has not been in a "healthy state"; Xcode tries somehow to understand the state of the repository but after a while, it just crashes.
Common scenarios where this could have happened:
A file was deleted
A file was renamed, specially with case-sensitive renames, for example from MyViewcontroller.swift to MyViewController.swift
The solution for me was to just put it back in a "healthy state", aka make a commit directly from the Terminal.
Example
From the Terminal
# navigate to the directory of your repository
$ cd /someFolder/myProjectApp
$ git status
# check that you get "nothing to commit"
# or if there are changes they should make sense
# if some changes do not make sense
# try staging and committing everything
# example:
$ git add .
$ git commit -m "Cleaning state"
Up until now I've been using Xcode with Subversion for my code repositories with no problem. Now I'm working on a project that uses a Git repository stored at GitHub, so I figured I'd go clone that repository to my local machine and get started.
In Xcode, I add the repository then tell it to Clone -- The machine chews on this for a while, and if I use the Finder I can see the files being placed in the target directory (which is a newly-created, empty directory on my system). After a while though, I get an error message:
fatal: destination path '/Users/myname/Documents/ProjectName' already exists and is not an empty directory.
I have tried this three times now, each time starting with an empty target directory, and it gives the same error message each time, so I know it has to be something I am doing wrong, or have not set up properly.
Thinking that perhaps something was going wrong and the system was trying to do a second clone operation (to a now non-empty directory) I tried canceling and trying a build, but some files are missing from the project -- so not all of it made it down to my system.
My searches on this issue turn up several hits for people doing the clone via command line and showing this error message, but not through the Xcode interface.
Does anyone have any suggestions about what might be going wrong?
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
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.
Please help. I have absoluty no idea what's wrong. The rails app works on my local machine.
If I do this:
git push heroku master
I get this:
Counting objects: 4195, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3944/3944), done.
Writing objects: 72% (3009/4178), 9.99 MiB | 73 KiB/s
Compressing objects: 100% (3944/3944), done.
**Connection to 10.46.xxx.xxx closed by remote host.KiB/s
error: pack-objects died of signal 13
error: failed to push some refs to 'git#heroku.com:gentle-rain-xxxx.git**
I just dealt with 24 hours of this hell. I re-cloned repos, destroyed apps, repacked, pruned... the whole 9 yards.
It turned out that I had a .txt file which was ~250MB in size that, even though I had removed it from my master branch, was still present in my local (as well as github) cache.
I checked out this page and inadvertently found my answer here:
https://help.github.com/articles/remove-sensitive-data
The .txt file had previously been in the doc/ folder, so I pointed this command at where the file would have been in any commits and ran it.
git filter-branch --index-filter 'git rm --cached --ignore-unmatch doc/US.txt'
This is very useful if you realize you have static assets of some sort that don't have to be in your repo and are causing you to get the signal 13 error.
I was having problems with a repository as small as 130MB. I don't really want to prune my repository, nor do I feel it is necessary.
I can't help but feel this is a problem with git and/or Heroku, I believe a big push should succeed, even over a "slow" or less than ideal connection.
How I solved/worked-around this issue was to spin up an EC2 instance, checkout my repo there, and push to github. In that way, my deploy speed was 4MiB/s (faster than my own 80KiB/s!). Furthermore, in the cases where the push would fail due to some configuration issues, I could quickly tweak and try again.
For more information on this technique, I've written up the full steps on how to spin up an EC2 instance for this purpose here: http://omegadelta.net/2013/06/16/pushing-large-repositories-to-heroku/
Hi I had the same problem trying push to cedar stack. I contacted heroku support and they fixed it. Here is what they said:
It appears to be due to a change in our git server on our end. I'll be
following up with our engineers to make sure we get a permanent fix
rolled out for this.
-Chris
This appears to just be a timeout from your push being too large.
I got around this by doing a git reset to a SHA that was around 500 commits back, pushing that, and then pushing the rest of my repo.