I have a project that was connected to a git repo. Now I changed the machine. I downloaded the project on the new machine and made changes. Now I am trying to connect to the same repo and push the changes but can't. VS Code shows everything as U(untracked). I signed in to VS code through GitHub just like my previous machine, yet all the files are shown as "U". How do I push the changes?
Asked
Active
Viewed 309 times
1
-
1When you copied the project, did you copy the full `.git` directory with it? Please explain more precisely what you mean by "downloaded". – joanis Feb 10 '22 at 17:51
-
2Regardless, you could resort to a brute force approach: make a fresh clone on your new machine, and copy all the changed files into that fresh clone. While it's not the most elegant approach, it's certainly the simplest one to explain! – joanis Feb 10 '22 at 17:53
-
By downloaded, I mean downloaded the code as a zip file from github (you get an option there). And then started working in that folder. – who-aditya-nawandar Feb 11 '22 at 06:14
-
Oh, I see. That download option is intended for when you want to use code but not modify it. If you want to modify it, you should do a `git clone` instead and copy the modified files into that sandbox. – joanis Feb 11 '22 at 14:30
-
But actually, this question has been asked several times on SO before. I think the accepted answer to this one could help: https://stackoverflow.com/q/15681643/3216427 and maybe the top answer to this one too: https://stackoverflow.com/questions/34354086/can-i-connect-git-if-i-downloaded-the-code-as-zip Backup your work before you start trying this! – joanis Feb 11 '22 at 14:34
-
1Does this answer your question? [How to clone git repository from its zip](https://stackoverflow.com/questions/15681643/how-to-clone-git-repository-from-its-zip) – joanis Feb 11 '22 at 14:37
-
Many more hits from SO at https://www.google.com/search?q=connect+downloaded+code+to+github – joanis Feb 11 '22 at 14:38
-
I used the brute force approach as suggested in your 2nd comment. You may post it as an answer and I'll accept it. – who-aditya-nawandar Feb 11 '22 at 15:53
-
Glad to know my recommendation helped. I won't post it as an answer, though, because this really is a duplicate question and I'm likely to get downvoted for answering it instead of closing it. Such are the ways of SO... – joanis Feb 11 '22 at 16:08