openshift-evangelists / kbe

Kubernetes By Example
https://kubernetesbyexample.com
Apache License 2.0
430 stars 175 forks source link

fatal: coudn't find remote ref master #55

Closed ryanj closed 3 years ago

ryanj commented 4 years ago

Having trouble pulling updates from master? (fatal: coudn't find remote ref master)

Try the following to fix your remote/upstream references:

  1. git pull origin
  2. git checkout -b main
  3. git branch main -u origin/main
  4. git remote set-head origin main
  5. git branch --set-upstream-to=origin/main main
  6. git branch -d master
  7. git branch -d -r origin/master

Then, open your repo's branch settings on GitHub and change the default branch to main at:

https://github.com/ /kbe/settings/branches

This should get you back to the usual workflow... Do this before adding new changes:

  1. git pull # as usual, always run git pull before cutting your next feature branch
  2. checkout -b my_new_feature_branch # to cut the new branch (cut from the fresh pull of origin/main)
  3. commit, push, and send a PR when you're ready to share your changes #biz as usual

Congrats on completing this cleanup work!

raphael-sena commented 1 year ago

Hi!

I'm a begginer.. I'm still having git pulling troubles with a new project, even after the explantion. Can you help me?

This bellow what I tried:

rapha@Nitro5 MINGW64 /c/ws-eclipse/2023/test $ git init Initialized empty Git repository in C:/ws-eclipse/2023/test/.git/

rapha@Nitro5 MINGW64 /c/ws-eclipse/2023/test (main) $ git remote add origin https://github.com/RaphaelSena/exceptions2-java.git

rapha@Nitro5 MINGW64 /c/ws-eclipse/2023/test (main) $ git pull origin master fatal: couldn't find remote ref master

rapha@Nitro5 MINGW64 /c/ws-eclipse/2023/test (main) $ git pull origin remote: Enumerating objects: 3, done. remote: Counting objects: 100% (3/3), done. remote: Compressing objects: 100% (2/2), done. remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (3/3), 784 bytes | 49.00 KiB/s, done. From https://github.com/RaphaelSena/exceptions2-java

rapha@Nitro5 MINGW64 /c/ws-eclipse/2023/test (main) $ git checkout -b main Switched to a new branch 'main'

rapha@Nitro5 MINGW64 /c/ws-eclipse/2023/test (main) $ git branch main -u origin/main fatal: No commit on branch 'main' yet.

rapha@Nitro5 MINGW64 /c/ws-eclipse/2023/test (main) $ git pull There is no tracking information for the current branch. Please specify which branch you want to merge with. See git-pull(1) for details.

git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

git branch --set-upstream-to=origin/<branch> main

rapha@Nitro5 MINGW64 /c/ws-eclipse/2023/test (main) $ git branch main -u origin fatal: No commit on branch 'main' yet.

rapha@Nitro5 MINGW64 /c/ws-eclipse/2023/test (main) $ git branch main -u main fatal: No commit on branch 'main' yet.

rapha@Nitro5 MINGW64 /c/ws-eclipse/2023/test (main) $ git remote set-head origin main

rapha@Nitro5 MINGW64 /c/ws-eclipse/2023/test (main) $ git branch --set-upstream-to=origin/main main fatal: No commit on branch 'main' yet.

rapha@Nitro5 MINGW64 /c/ws-eclipse/2023/test (main) $ git branch --set-upstream-to=origin fatal: No commit on branch 'main' yet.

rapha@Nitro5 MINGW64 /c/ws-eclipse/2023/test (main) $ git branch -d master error: branch 'master' not found.

rapha@Nitro5 MINGW64 /c/ws-eclipse/2023/test (main) $ git branch -d -r origin master error: remote-tracking branch 'origin' not found. error: remote-tracking branch 'master' not found.

rapha@Nitro5 MINGW64 /c/ws-eclipse/2023/test (main) $ git remote -v origin https://github.com/RaphaelSena/exceptions2-java.git (fetch) origin https://github.com/RaphaelSena/exceptions2-java.git (push)

Nazir-Rizwan commented 12 months ago

git remote add origin 'url_of_your_github_project'

git push -u origin master

specify which branch to push then mention check branch git branch (for local)

tiru233 commented 2 months ago

git remote add origin 'url_of_your_github_project'

git push -u origin master

specify which branch to push then mention check branch git branch (for local)

Thankyou for the help. this helped me to resolve the issue.