Save me from git

When I do: "git commit -m "initial commit"" It says it tries to track files that are not in my actual folder, but the files from my user folder! I have a git config in my user folder that I just edited, maybe that made it happen somehow. Anyone has any idea what to do with this sh*t? It said before that I had problems with my git config, and all I want is to push my project into a damned empty repo, and it won't work
15 Replies
Vincent Udén
Vincent Udén3y ago
How did you initialise this git repository? It uses the .git folder as the base for the version control tree, so if there isn't one in your current directory it will traverse up through directories until it finds one
Aviv
AvivOP3y ago
I created the repo through the github website, and planned to connect to it and push to it through the vscode terminal. So maybe I should add a .git folder to my project?
Vincent Udén
Vincent Udén3y ago
You created a repo on github, then cloned it to your local machine?
Aviv
AvivOP3y ago
I didn't clone it, I tried to use these commands:
Vincent Udén
Vincent Udén3y ago
Allright, you have a project already on your PC, which you want to upload to github?
Aviv
AvivOP3y ago
yes\
Vincent Udén
Vincent Udén3y ago
The easiest way to do this, is to clone the github repo, then copy all the files from your project into the repo before committing and pushing. That is unless you've already got a local git repo to which you've already got a bunch of commit history that you care about.
Aviv
AvivOP3y ago
Can I clone an empty repo? like I don't see any option to clone
Vincent Udén
Vincent Udén3y ago
Yup git clone https://github.com/username/repo
Aviv
AvivOP3y ago
I ran the command on my project root, now what do you mean by " copy all the files from your project into the repo" 🙂
Vincent Udén
Vincent Udén3y ago
Well, that works even if its not exactly what I meant. Then take all the files from your project, (I have no idea what those are since I dont know what project your making). Everything that contributes to your project. The source code, resources, etc. Keep the exact same folder structure for all of it, just select it and move it inside the new folder which was created when you ran git clone
Aviv
AvivOP3y ago
You have just saved my day in ways that cannot be described with words So from now on I will do the clone method that youve taught me
Vincent Udén
Vincent Udén3y ago
Yeah I think that is a lot easier. It sets up the remote host and git repository for you which is usually easier unless you really know what you're doing
Aviv
AvivOP3y ago
Thanks a lot, you just saved my day/s
Vincent Udén
Vincent Udén3y ago
No worries, git can be a bit unintuitive at times
Want results from more Discord servers?
Add your server