github - Adding a file to branch - github

So I'm following these instructions: http://mark-kirby.co.uk/2008/using-git-and-github-on-os-x, and so far I've cloned the project I want to work on and created a branch.
Now I wish to add files that exist in another folder on my machine, but I keep getting the following:
fatal: pathspec 'Users/mic/OnePageCRMVC/MKTsite25-05/index.html' did not match any files
However, the file definitely does exist...
Am I trying to do something that is not allowed and the error message is throwing me off?

You cannot add them automagically. You should copy the files into the git repo manually, then do a normal add/commit.

Related

Switching Remote Urls from HTTPS to SSH

I tried to switch from a HTTPS to SSH repo using git. Below are the first commands I used.
Then, when I tried to add a branch to the staging area, I got the following messages:
I am not able to push anything or add any commits to git from my command line either. I get an error saying "could not read remote repository". Could someone please help me? What should I do now? I am new to git and I don't want to dig myself in a deeper hole!
Check for a .git/ subfolder in:
your current working directory (where you switch to SSH)
your parent folders
If you see one in any parent folder, that would make your current working directory a nested Git repository.
Ideally, there should not be any parent Git repository above your own: see if you can remove those parent .git folders (or move them elsewhere).

Git add is ignoring certain files even when .gitignore does not exist

I am facing a rather strange issue with my git working folders. Here's the summary:
I previously had a local git repo with a .gitignore file that ignored certain files/folders.
I deleted the repo (.git folder) and also the .gitignore file
Then I initialized a new one with git init in the same folder. Now when I do a "git add .", the previous ignore pattern is retained for some reason.
Even stranger,this happens with any new project following the same folder structure no matter where I place the project on my computer.
I tried deleting and recreating the files multiple times. I even created a new .gitignore file with a different pattern. It does not seem to have an effect except when it is set to ignore everything (with just * in the file)
My guess is that the .gitignore pattern I deleted is somewhere saved that I dont know the location of. If anyone has faced a similar issue or know what I could be missing, I'd love to know.
I am still new to git. Sorry if this is something very obvious that I have missed out on.
UPDATE:
I still have not found the reason for this behaviour but managed to reset everything by doing 'git add --force .' in the directory and then deleting the repo. Now I initialized a new repo that works as expected.

stop git from tracking a file without removing the file from other developers machine

I have a file name settings.py. In my host machine settings.py has a different configuration with that of other developers. I want to stop git from tracking settings.py but not to delete this file from other developers machine when ever they pull changes in the project
Some people talk about including the file in .git/info/exclude folder.
But i have no idea as where to locate this file. I searched for it in my project folder( where git has been initialize). To no avail.
expected result
When ever i commit changes, all changes are push to master except my settings.py file, but not deleting this file from other developers machine when ever they pull my changes.
You already mentioned the correct answer. You can use .git/info/exclude as also documented here.
If you have not created this file yet, you can do so now. Simply place a text file called exclude in .git/info. The .git folder should be present already in the root of your repository.
The file uses the same syntax as a regular .gitignore file, but will only be applied to you.
You can also manually specify a core.excludesfile as described in this answer:
git config --global core.excludesfile ~/.gitignore

How to end 'another git process' running in same repository?

After my first attempt at committing a couple of large folders (angular and django), git responded with:
Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.
Previous posts recommend:
removing the index.lock in the .git folder.
I've done this, but the second that i resubmit "git add . " as part of my git push origin master routine, the index.lock file reappears in .git
Is there another solution? And what has happened to warrant this?
I've tried all the suggestions in the commented link
I'm working with this:
git version 2.13.5 (Apple Git-94)
In my case, index.lock wouldn't delete. Instead, I found that one of my django folders lacked a .gitignore, so I created one and included the following files:
include
lib
include
bin
.vscode
You might want to include more or less, depending.. Apparently, I was attempting to push a file that disagreed with git.

Creating new git repository, can't add directory

I am about to throw my laptop through a wall, and am hoping for help before reaching that point. For reference, I am following these instructions exactly - https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/.
I have a directory ".../path/thisdir". Inside of thisdir are (1) a file called Demo.R and (2) a directory called sportVU. sportVU is a directory with ~15 files in it.
When I follow the instructions in that link, my github repo looks like this:
https://github.com/NicholasCanova/packageSportVU
Notice that the sportVU directory link cannot be clicked in github, and when I download the repo, sportVU is an empty folder. Why is this happening? This shouldn't be so tough.
EDIT: this is what the repo looks like in my local machine, I'm 100% sure it's not empty:
It could be that you have two .git folder in your directory. View hidden folders to see.
Similar questions:
What does a grey icon in remote GitHub mean
Why can I not open my folder in GitHub?
Since Git doesn't store empty folders the steps you should follow exactly are:
Delete the old repo and start again following exactly my steps.
git clone <repo url>
Inside the folder of the cloned repo create a directory manually and name it as you want i.e sportVU.
Drag and Drop all the files you want in the sportVU direcrory.
cd to Myrepo/sportVU and type git add *
type git commit -m "added some files"
git push -u origin master.
and you should be all set