Cannot PUSH recent commits to Github that have been pushed to Bitbucket - xcode

I have two remote repositories. One is private (Bitbucket) and the other public (Github). I had been pushing changes to Bitbucket using Github app and then pushing the same commit to Github repo using Xcode. However, recently I have been unable to PUSH the commits to Github and using SourceTree I get this error message:
This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/pre-push.
This is how it looks from within SourceTree:
How can I get my Github repo to accept the most recent commits?

You have a pre-push hook which is telling you that you have git-lfs (large file support) enabled for this repository, but that it can't find the git-lfs program on your computer. The solution is to either remove the hook (which is located in .git/hooks/pre-push, as the error message says), or to fix your PATH so that it can find the git-lfs program.

It would have been enough to say that the .git directory is in the original local directory of your repository and you probably need a program like TextWrangler or similar, that shows the hidden files starting with a dot, to be able to see it and delete it by moving it to the trash (right click mouse). It took me one hour to figure out this. I hope no one else have to waste that time.

Here is the instructions for removing the pre-push file using Mac Terminal:
First: cd to the directory that is your local repository for your project. (The main folder that holds .xcodeproj and other files) The .git file is hidden but you can still access it by typing cd .git/hooks in terminal. If you type ls in terminal to view all files within the current directory, you'll notice the pre-push file. Type rm pre-push to remove the file. You should now be able to push to your remote repository. Just be sure to cd .. back a few times to your local directory for your project. Simple as that.

Related

git pull added tons of untracked files and modified files

I am not very familiar with git as I just use it in the most basic manner. Lately I've been running into this strange behavior which makes no sense to me and causes a huge disturbance in my productivity. For certain branches when I run git pull instead of just getting the latest commits from the remote repository like I expect, I get an ENORMOUS list of modified/deleted/added files as well as an enormous list of untracked files. The branch I am pulling from is our team's master branch. I am just trying to keep my local copy of master in sync. What are these other untracked files showing up as well as these modified files? I didn't touch any of these other files.
What makes the problem worse is that I can't delete these untracked files or anything. I've tried `git clean -fx' and it only removes 3-4 files but still leaves hundreds. At this point I just want to get rid of all of these files, delete the branch, and pull the branch from remote again.
I tried doing the following:
git fetch --all
git reset --hard origin/<remote_branch_name>
but I received an error because Git couldn't create a symbolic link. I am using Git on Windows.
Why is git pull doing this, and what should I do?
EDIT: I was finally able to run the git reset command when I ran my prompt as an admin, but it still doesn't explain this weird git pull behavior.
It seems to me that the 'git pull' action did not complete successfully.
It is possible that you modified some of the files as an admin, and when pulling as non-admin user git tries to modify or delete a file and has no permissions to it.
Therefore you stay in some half baked state.
What do you see when you run git status?
Is there any error in the git pull?

How can I use third-party/command line git with MATLAB open?

Using the command line or a third-party git manager, I can execute basic git commands like commit, reset and stash with MATLAB open, presumably because I'm working solely on my local branch. As soon as I want to use git checkout somebranch I get the error:
fatal: cannot create directory at [dir]: Permission denied
What's worse is that my current working directory (on the old branch) now has unstaged changes from the branch I wanted to checkout. Other programs simply reload the files from the newly checked out branch. I've tried finding a way to change how MATLAB locks files but to no avail.
MATLAB R2017b
Windows 10 Pro
More Info
The file structure in my git directory is different between the two branches. I think the issue arises from the fact that a deleted sub-directory was in MATLAB's "set path" list.
First, I would recommend
using a separate git (from the latest Git for Windows and a simplified path)
using a separate working tree (meaning a separate folder) with git worktree.
Second, double-check any locking issue with Process Explorer.

How can I fix error: pathspec 'git-practice-project/git-practice-project' did not match any file(s) known to git

I've created a project to practice using Git with Xcode and GitHub. After a lot of work, I've got the repositories created both locally and remotely. I just tried to make a commit and got this error:
Here's what I'm trying to commit:
The last things I did before I got this error were:
I added a .gitignore file using the GitHub Swift template in order to remove the .xcscheme file from the cache
from the Terminal, I ran 'git rm --cache'
I created the test_file and then tried to Commit
But I can see the folder in the finder:
I looked around SO a lot and found many questions about git commit problem but what I found had mostly to do with diacritics and other issues that aren't the same as mine.
Did the 'git rm --cache' lead to this situation? What can/should I do to safely correct this problem?
Thanks
Update: Seems I really got myself into pickle. I've got nested 'git-practice-project' directories several levels deep:
I've started at the deepest directory, did an ls, and a git status, the backed myself up to the top doing the same thing at each level. It looks like only the two highest directories have uncommitted changes and the project.pbxproj file exists in both of them.
I don't use Xcode's SCM features so I am not sure why Xcode is confused here. But it looks like the files under git-practice-project/git-practice-project aren't known to git yet. You need to add the directory to git. On the command line from the project's root directory you could try:
git status
That should list your files that have been modified, deleted, and that aren't part of the git repo yet.
Add the directory and its contents:
git add git-practice-project
Once you have done that, you should be good to go to use the SCM tools in Xcode again.
Update: In Xcode, you can select the file that is marked with the ? and then go to the Source Control menu and select Add Selected Files.
Ran into this with Xcode 10, with newly added files. You first need to add the new files to the repository. Simply select the file in the navigator on the left, right-click, then Source Control in the pop-up, and select "Add Selected Files". After this the commit will work.

How to restore version control in XCode?

I have just recently backed-up my XCode C++ project on my pendrive, using
rsync -avu
Since then, the version control for my project is grayed-out on every files, I can modify the files and not see the "M" nor the "A" sign. The only files still having version-control working "shared" files for which it works correctly. (Those shared files belong to a different project called "Shared").
I have tried git commit -m, git add . and even git init where the files were. Nothing worked.
Can you please help restoring version control for my project?
UPDATE:
Answers for the questions in commens (and answers):
my git repository is on my local hard drive.
I went to the Organiser-repository pane in XCode and I see my recent git commit -m "sth" as "sth" az a commit. I have a single branch: master.
Im not sure what command would be good to test git, as my commits work (theoretically).
I have a folder named .git in the project folder.
git log is working, showing the same as XCode Organiser-repository pane.
I think the XCode just can't synchronise with the git for some reason, and I don't know how to correct that.
First off, this is not an answer that will fix your problem, I just try to provide some help that might get you closer to a diagnosis.
Git stores its files in a folder named .git. Check if this folder is present in your project. If it's not then your Git repository is gone.
Next, try some basic command such as git log. For this to work, you must first cd to your project folder (or a subfolder thereof), because whenever you run a Git command it will look for the .git folder in the cwd or a parent folder. If git log does not work then your Git repository is broken in some way. Someone else will have to step in to further diagnose the problem, as I am no expert on this subject.
Finally, you should also check whether your rsync command has really sync'ed your project's .git folder with the backup's .git folder. Use this command:
diff -rq /path/to/project/.git /path/to/backup/.git
If there is no difference (as I would expect if rsync has worked correctly) then the problem with your Git repository is both in your project and in your backup. If there are differences then it might be worthwile to try your next steps on a copy of the backup (it should be fine to make the copy in the Finder).
Good luck.

Moved file location in Xcode 4, can't push to Github

Git newbie here. Using Xcode 4.3.2. Had to move my project file directory. Commit still works fine but when I do a git push, I get Everything up-to-date, which is incorrect.
How do I get back on track?
Thanks
Check also if you are not in a DETACHED HEAD mode.
That happens if you checkout a tag or a file (see git checkout illustration in gotgit):
That was the case for the XCode question "Git (no branch) in xcode"
When you moved the project directory, did you move the .git folder with it? An easy way to check is to run git log and see if all of your previous commits are still there.
If you moved the .git folder with the rest of the files, then your remotes would still be setup correctly.
If it really isn't hooked up for some weird reason, try running git remote show origin and check to make sure that the url is correct and everything.

Resources