#πŸ”’ I am trying to push(to github) but still stuck on the same problem for 2 days..

159 messages Β· Page 1 of 1 (latest)

untold coral
#

i just can't push my work on github..i tried so many things but still stuck and got no progress

wraith gazelleBOT
#

@untold coral

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

hasty viper
#

your repos origin and local repo are out of sync

untold coral
#

i tried pulling ..pulling is working but not pushing

hasty viper
#

pulling is not actually working...it's showing a fatal error in your screenshot

hasty viper
#

do you own ASL2025 btw?

untold coral
#

yes

hasty viper
#

can you show git status screenshot

#

do git status

untold coral
hasty viper
#

do git remote -v

untold coral
hasty viper
#

ahh makes sense now

#

git remote rename original origin

do this to rename back to the original repos's remote url name

#

then git pull again and push

untold coral
#

yesterday i tried so many methods..and the situation of my git is worse now

hasty viper
#

can you do git fetch first before git pull

untold coral
#

only 'git fetch'?

hasty viper
#

yeah

untold coral
#

nothing happened

hasty viper
#

did you by chance accidetanlly delete your .git folder at any point?

untold coral
#

i deleted some files on github

#

and commit the changes

hasty viper
#

the issue is definitely not the github, it likely ur local changes

untold coral
#

i used rebase yesterday

hasty viper
#

how many changes did you make in the local version?

#

show git log

#

git log

untold coral
#

3 to 4 commits per repo

hasty viper
#

wait..

#

what do you mean per repo...this codebase is one repo

#

not multiple

untold coral
#

i was trying to save my changes on github..so i was pushing all my repos

#

but it worked only once

hasty viper
#

a single git repo cannot contain multiple sub git repos

untold coral
#

and then the error came like in the first ss

hasty viper
#

you need git submodules for that

#

which is more advanced if ur new to git

untold coral
hasty viper
#

wait what

#

ur supposed to be in the 100-days-of-code folder when u do these commands

#

did you change the repo name?

untold coral
#

no.but both repo are raising the same error

hasty viper
#

what is ~/shopping folder contains

untold coral
#

so i send you the other one too

#

but if you want i can send you the 100 day's one

hasty viper
#

okay...so that's shopping folder contents right?

untold coral
#

yes

#

please tell me you can solve this problem

hasty viper
#

can you show me the full screenshot of git log...it cuts out at the right side

untold coral
#

of shopping repo?

hasty viper
#

yeah

untold coral
hasty viper
#

just to be sure, you closed 100 days of code repo made changes and commited and also rename the folder name right?

hasty viper
# untold coral

i can't the see the full thing on the right...what's first

untold coral
#

branch

hasty viper
#

dude, paste the screenshot

#

i can't help you if i can't see the the log properly

untold coral
hasty viper
#

try git push -u origin first_branch

#

just directly

#

try

untold coral
#

it worked

#

i think

hasty viper
#

great

untold coral
#

but main branch is still giving the error

hasty viper
#

what error?

untold coral
hasty viper
#

well trying pulling again first

#

so simply do git pull

untold coral
hasty viper
#

ahhhh

#

you accidentally remove the remote for that branch

#

do git branch --set-upstream-to=origin/main main

#

then git pull

untold coral
hasty viper
#

what happens with git pull origin main

untold coral
#

same error

slim pike
#

did you rebase ?

hasty viper
#

exact same error?

untold coral
#

yes

untold coral
#

day 11 and day 12

hasty viper
#

show git log again...

slim pike
#

first stash all changes

untold coral
hasty viper
#

why would stashing help?

#

it's an unrelated histories problem

untold coral
#

i never did stashing and rebasingbefore

slim pike
#

Stashing so that current changes doesn't get lost in process

hasty viper
#

it's better for them to just backup the entire folder somewhere else

#

instead of dealing with stashing and rebasing, and screwing up the repo

slim pike
#

i find stash better

hasty viper
#

stashing mid debug isn't exactly a solution

slim pike
#

then we can checkout to main and pull,
then back to branch and rebase and see

hasty viper
#

we're already in main tho, what's weird is pulling is causing issues with merging

#

usually u would expect a merge conflict, but instead we're getting unrelated histories which suggests something esle

slim pike
#

do git status

hasty viper
#

it's empty nothing in staging area

untold coral
slim pike
#

we can force it

hasty viper
#

no, i'm trying to do this without force

#

since some commits are missing from the tree

untold coral
#

i tried force but it overwrites the files in github

slim pike
#

staus shows diverged branches

#

do git pull here

hasty viper
untold coral
slim pike
#

force it

hasty viper
#

bro stop saying to force ...

slim pike
#

why are you not doing in vscode or somethign

untold coral
#

let me tell you one more thing...in 100 days of code folder, my files got deleted

hasty viper
#

what does vc code have to do with this

slim pike
#

eariser to resolve in editor

#

git pull origin main --allow-unrelated-histories

hasty viper
#

no

untold coral
#

day 11 and day12

hasty viper
#

that's not a solution either

crisp torrent
#

git push --force original main

But use this only if you're sure you want to erase the remote's history and replace it with your local repo.

hasty viper
slim pike
#

so i said stash it

untold coral
#

but while writing ls in shell it shows day 11 and day12

hasty viper
#

look we want to preserve the orignal repos commits not overwrrite them with force

slim pike
#

git reset --hard origin/main

hasty viper
#

you have to be trolling

#

@untold coral do not run reset hard

#

it will lose ur local changes

hasty viper
#

in this case they already commited

slim pike
#

i get it

#

why are we not using git pull origin main one

hasty viper
#

okay this is not productive...we already went over this

untold coral
#

so no results again?

hasty viper
#

most likely u will need to do interactive rebasing...but since the first commit does not match the origin, even that won't solve the issue

slim pike
#

better join vc

hasty viper
# untold coral so no results again?

at this point, it's probably easier to just cherry pick all the commits from the remote (main) into the local main and then do an interactive rebase

slim pike
#

that's why i said easier to do in vscode or something

#

easily cherry pick

hasty viper
#

could be

untold coral
#

i got to go now....can you tell me in a nutshell what to do

#

can we somehow continue this later?

slim pike
#

do a git clone in a different directory and push in a new branch there

#

some manaul effort but better

hasty viper
# untold coral i got to go now....can you tell me in a nutshell what to do
  1. Create a new remote called original_main pointing to the 100 days repo
  2. do git remote update to get all the original main commits
  3. while inside local main, cherry pick the commits from original_main's main branch
  4. git push
  5. remove original_main remote
  6. do interactive rebase to put the cherry picked commits in correct order
  7. git push πŸ™‚
#

it's basically a lot of work...if you have many changes tho it's worth it

slim pike
#

do you think he won't mess up

hasty viper
#

prolly will for sure

#

seeing as this is a repo just for learning...it's prolly way easier to just clone the repo again and do the commands properly this time around

wraith gazelleBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.