Next.js Discord

Discord Forum

(UPDATE NEED HELP FROM WINDOWS USER)issues getting existing code into a new github repo

Unanswered
bobonlan posted this in #help-forum
Open in Discord
Original message was deleted.

190 Replies

did the 3 dots and remote add and picked the correct empty repo, but the commit button is greyed out and when i go to the repo on github there's no code inside
What three dots?
What editor are you using
Or are you using pure git cli
using VS Code is my editor, the 3 dots is a settings tab in the source control tab in VS Code
Screenshot
clicked add remote, hit enter, it popped a list of repos, i picked the one
Screenshot the bottom left of the screen
?
did that get whatever ya needed
So it’s already connected to the github repo
Make some dummy change
in the code?
okay
Then git commit -a -m "test"
Yes
Yes
Now take the screenshot of the source control column
In vscode
shall i hit it?
Yes looking good
Hit it
Does it show up as success or failure?
If no dialogs show up then it is a success
Oh ok
Go to terminal do
git remote -v
Oh no looks messy
Do this
First, go to the repo, delete it and make a new one
We start afresh
i kinda sorta understand how it got that way i just wish it hadnt lool. gonna do those steps now
When creating the repo, do not add any files
Use a completely blank repo
Uncheck any boxes that add readme or license
oh shit that might be it lets see
No that isn’t it, it’s just if you added those files in later on there may be git conflicts and I don’t want to explain that relatively advanced concept now
okay new repo made
sorry had another sentence but deleted it
Np now what does the repo page look like
Good, nice
Now in local
Delete the .git folder
local meaning?
Your computer
Use file explorer
Go to the local folder
oh like the source ofGit
Find the .git folder
Likely it is hidden, unhide it
Then delete it
?
or will it literally be .git
Literally .git
No not this one
The working directory where you want to upload code to github
how do i find it if it's hidden?
Take a screenshot
@bobonlan Click to see attachment
No not this…
If you want to upload d:\a\b\c to github
im sorry
Then use file explorer to go to d:\a\b\c
The folder you used vscode to open
oh
so delete .git
Are you there yet
ye
Take screenshot
So you want to upload this bobingus folder content right
yes
Yes then remove that .git
Then go to vscode and refresh it
i need admin rights?
Then take screenshot of vscode source control tab
its my fucking computer
@bobonlan i need admin rights?
This is a windows issue I cannot comment
rip me
we were so close
@joulev Then take screenshot of vscode source control tab
Go ahead and try to delete it, then take the screenshot. I’ll go for a few minutes (maybe)
Google how to get admin right or whatever, I don’t use windows idk
okay i will
okay yeah i guess im stuck here for a bit
bump
@bobonlan Click to see attachment
Are there multiple users?
theres 2 on the machine but when i go into the security settings it says my account has permissions for it
Update: I was able to delete the folder
only took five days 😭
now i assume you have a blank github repo
and a non-git project right?
im gonna log into github and confrim theres a blank repo
@joulev Then take screenshot of vscode source control tab
now take this screenshot and send here
@bobonlan im gonna log into github and confrim theres a blank repo
yes, that repo should look like this
perfect thats what mine looks like
@bobonlan Click to see attachment
perfect
now go to the terminal in that project folder
vscode terminal should do that
and run git init
so now im golden?
just hit commit everytime i do an update?
@bobonlan just hit commit everytime i do an update?
hold on not so fast
okay i havent clicked anything after git init
yes, now type the commit message in that box
anything, "initial commit" for example
and hit commit
i think there will be a dialog box
dialog box or not, screenshot the result
nice, as i expected
click "Always" to never see this dialog again
epic
now what does the source control tab look like
now theres a publish branch button in src ctrl
nice
now go back to the repo on github
you should see a bunch of commands
check the "…or push an existing repository from the command line" section
you'll see something like git remote add origin https://github.com/joulev/blank.git
copy that command and paste in the terminal
alrighty done
what does the source control tab look like now
and what is the branch name at the bottom left
i think branch name should be main already right
branch is master, src ctrl still just has the publish branch button
@joulev check the "…or push an existing repository from the command line" section
ok then copy the next command in this section, should be git branch -M main
and paste and run it in the terminal
the branch name becomes main right?
yes
nice
now copy the next command in that section
should be git push -u origin main
run it
what does the terminal output look like
good, now go to the github repo, and refresh the page
do you see your code there
you should see the code there
yes
good
theres a red x tho
the set up is done
next make a dummy change in the code
@bobonlan theres a red x tho
that is a different issue, we will get to later
add a hello world in readme.md or whatever
okay change made
now go to the source control tab, make a random commit message, then click commit
then screenshot the bottom left corner of vscode
should i hit sync changes too
screenshot
good, now click on that 0 v 1 ^
or the sync change button
both of them work the same way
ok nice, i see your commit on github now
so that's the git 101 course on how to set up a project and push to github
okay it did a load animation and then the numbers disappeared
@bobonlan okay it did a load animation and then the numbers disappeared
correct, because now your local is synced to github
thank you
now i just gotta remember how to make the repo link to a domain lol
@joulev so that's the git 101 course on how to set up a project and push to github
from a non-git local repo:
1. git init
2. make an initial commit in source control of vscode
3. create a blank github repo. completely blank, no readme nothing else
4. copy and run the commands from the section "…or push an existing repository from the command line"
5. set up done
to commit after setup, just commit in the source control, then hit the sync change
now the red X is because github couldn't deploy your app to github pages
uh oh
i don't use github pages so idk, can't help here
but you should probably just deploy to vercel instead
or netlify
or any services that deploy a vite project well
is vercel free and does it require learning new stuff
vercel is free and its UI is quite intuitive
i don't think it needs learning
log in with your github, then make a new project
then it will i think just work
sweet
I will bookmark this thread