Stuck in git loop - xcode

I had an issue where I accidentally copied a directory into a subdirectory of itself thus creating thousands of git transactions. After unsuccessfully trying to clean that up, I decided to create a new project and copy the files over from the old one. Somehow I think I've messed git up, but I'm not sure where the problem is. Here are my current symptoms.
I thought I initialized the git repository correctly. However, none of the files exist on github.
https://github.com/victorengel/matchismo2
... except what I created there.
The project itself is an iOS single view application that I created with git enabled. I copied over all the files I needed from the old project to the new project area, confirmed that it ran, and then tried a commit. The commit seemed to work, but the push didn't.
If I tried a push, I got a message that the working copy is out of date and that I should do a pull. If I tried a pull, it said there were uncommitted changes and I should abandon them or commit them. After some rooting around, I figured out that the change triggering this was a user data change that should have been ignored in .gitignore.
I finally have the .gitignore set up the way it needs to be. I think the repository is set up right on github.com, but I'm still getting errors.
I can commit but not push. If I try to push I get the message "Working copy out of date. Try pulling from the remote to get the latest changes, then push again."
If I try a pull, I get the message "matchismo2/master" is not a valid remote branch to pull from. Please choose a different remote branch.
Looking around at github.com, there is only one branch, master under victorengel/matchismo2. To me it looks like everything is set up properly, but apparently I'm missing something. What is it?
In Xcode, in the organizer, if I click on Branches, there is one item listed: master.
If I click on Remotes, there is one item, matchismo2, and if I expand it, master is listed.
I've been assuming this matchismo2 with master underneath it is what is supposed to match the "matchismo2/master" that's in the error message. Looks like a match to me, so why isn't it working?
EDIT:
If I try pulling from the GitHub application, I get an error message "There aren't any remote branches on the server yet." If I try publishing from GitHub, I get the following:
git: 'credential-osxkeychain' is not a git command. See 'git --help'.
2013-03-05 16:32:43.680 GitHub for Mac Login[68518:707] AskPass with arguments: (
"/Users/brillig/Downloads/GitHub.app/Contents/MacOS/GitHub for Mac Login",
"Password for 'https://victorengel#github.com': "
)
2013-03-05 16:32:43.763 GitHub for Mac Login[68518:707] Error reading attributes: OSStatus -2033889429
2013-03-05 16:32:43.764 GitHub for Mac Login[68518:707] Error reading attributes: OSStatus -2033889429
2013-03-05 16:32:43.919 GitHub for Mac Login[68518:707] Error reading attributes for password: OSStatus 840183217
git: 'credential-osxkeychain' is not a git command. See 'git --help'.
To https://victorengel#github.com/victorengel/matchismo2.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://victorengel#github.com/victorengel/matchismo2.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
(256)

How about ensuring all your files are in order, renaming your branch, and pushing to the new (renamed branch) ? Then once you determine everything you need is actually there and your new code works, you can force update the master. Not an ideal way to do it, but it might work for you.

Related

Cannot check out new branch because of invalid path?

I'm trying to clone a repo to my computer. I do the standard
git clone [link to bitbucket repo]
and then call
git branch -a
to see my remote branches, which shows
remotes/origin/develop
which is the branch I want to checkout into. However, when I type
git checkout develop
I get an error that says
error: invalid path '.\api-log\api.log'
and it fails to create the local develop branch. Is this happening because there is something wrong with the file? If so, how can I fix/remove the file so that the clone will go through? All the work is in the develop branch and nothing in the master.
I'm using Windows.
Apologies if this has been answered before but I couldn't find anything.
I don't know exactly why this happen but I suggest you to remove the offending file from the repository history by the wonderful BFG tool.
At this url https://rtyley.github.io/bfg-repo-cleaner/ you can get the software and the documentation.

Github Windows: New branch created from command line not showing up on github.com

I created 2 new branches using the command line, and when I use the command 'git branch' I can see all of my branches in the window, but when I used the command 'git push' I get a message that says, "nothing to commit, working directory clean' and so I'm not seeing my new branches on github.com.
Can anyone shed some light?
Thanks!
Robin
Have you tried git push origin my_new_branch?
The below command will work:
git push origin devbranch
After running the above command git push origin dev I got this error "remote: Repository not found."
I had a similar error in which i created and published a branch on one computer. But on another It wouldnt add the branch automatically (even though the git server had the new branch). I simply did a pull from shell rather than using the app's sync function. once I did the git pull then it added the new branch and was able to be selected from the gui.
I assume this is a bug

Cannot clone GIT repository on network drive

Using Windows 7, we have a bare GIT repository set up on a network drive so that multiple users can pull/push from it. I am able to create a new working repo on my local and multiple other networked drives. However, when I try to clone a new working repository on the same network drive (different folder) , it fails.
Using TortoiseGIT, after I right-click and choose "GIT Clone", put in all of the necessary paths to my bare repo (the new working repo is already filled in) and hit ok, I get the following error:
Cloning into 'R:\path\to\new\repo'... done.
error: refs/remotes/origin/master does not point to a valid object!
error: Trying to write ref refs/heads/master with nonexistent object 5d2164db2c61efc7a5598f6ff75ed3fbbb12456e
fatal: Cannot update the ref 'HEAD'.
fatal: The remote end hung up unexpectedly git did not exit cleanly (exit code 128)
and it fails to create the repo. It does however build the new folder & ".git" subfolder structure.
It's not a r/w permissions issue because I can r/w any other files, but just cannot seem to create this newly cloned repo. My co-worker cannot either. Even if I got to another folder on the network drive, I still cannot clone the repo successfully. Surprisingly, if I just copy/paste a repo I created in another location, then manually do a "pull", it works and updates successfully.
Any ideas on what to try next? Obviously I've Googled "exit code 128" and "cannot update the ref 'HEAD'" but cannot find a solution to my issue. It's probably something really simple that we are overlooking, but we're just getting started with GIT and this is really causing us headaches...
UPDATE: I just noticed that when I do a manual pull from GIT to my "copy", it is doing a Fast-Forward. Maybe this provides some additional clues?
From R:/path/to/repo
* branch master -> FETCH_HEAD
Updating 5d2164d..d75bdb7
Fast-forward
Files.py | 3 +++
1 file changed, 3 insertions(+)
Success
Git might be trying to do some smart stuff with hardlinks that fails on the network drive. Try using git clone --no-hardlinks /r/path/to/my/repo or git clone file:///r/path/to/my/repo
Please do this via command line in msysgit
git clone /r/path/to/my/repo /r/some/other/path
Further, I would recommend using git from the command line as it is a tool that was designed to be used from the command line. You will be able to find more help, faster, with any issues that come up for you.

Github failed push

So to make a long story short, I've been working on a web app for the past few months. Recently I had to get a new laptop and cloned the repository from github onto my new machine... However whenever I commit changes to my app and attempt to use git push -u in the app's root directory i get the following message:
To git#github.com:acc/etc.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git#github.com:acc/etc.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
but when I try git pull git#github.com:acc/etc.git master I get a message telling me that the pull was aborted.
From github.com:acc/etc
* branch master -> FETCH_HEAD
error: Your local changes to the following files would be overwritten by merge:
config/routes.rb
test/fixtures/users.yml
Please, commit your changes or stash them before you can merge.
Aborting
so then i commit my changes using git commit -m 'fixing' and then attempt git pull again.
however this time I got messages stating that practically all my files had an "Auto-Merging CONFLICT"
am i totally screwed with this particular repository? I'm not really sure what to do since git is still somewhat new to me....
am i totally screwed with this particular repository?
No, but you will have to do a manual merge, since Git can't figure it out. git status will tell you which files need editing. The files themselves contain markers indicating where you should edit. When that's done, git push should work again.
If the changes aren't that big, consider making a copy of the entire folder/project in a different directory outside of the project, then git reset --hard HEAD will wipe out, erase and delete your recent changes.
You can then apply them again individually using your save3d copies for refernce.
Make sure sure you git add before git commit of course.
Finally if you get auto commit merge issues you can always just edit the files manually to resolve.

Can't push on a remote git branch in xcode

I come to you because I have this really annoying issue. In xCode, I deleted some files and now, when I want to push my sources, it says that I can't since there is some uncommitted change. The uncommitted change come from the deleted files (xcode shows me these files marked with a d).
My question is how I make my git repo sync with it so I can push my sources ??
In addition to the answer of triad:
Select your project in the Project Navigator
Select under the File menu->Source Control->Commit
Select under the File menu->Source Control->Push (if you want to push it to a remote repo)
On the Mac it helps to research the items under the menu bar, as the popup menu is not always populated fully.
You need to commit your changes before you push onto your remote. If you go to your project directory, type:
git status
It should show you the files which have been deleted. If it looks okay to you, type:
git commit -a -m "your commit message here"
Then you should be able to push to your remote repo:
git push <remote> <remote_branch>

Resources