Git push -u origin master: hangs; nothing happens; repo not updated

Goal: Push my first commit from my local repo to my private repo.


git push -u origin master seems to hang.

That is, it doesn’t product output in the terminal, the repo that I’ve set as the origin doesn’t show the files, and I have to cancel the process via control + c.

git issue.png

What I’ve done:

$ cd leetcode
$ git init
$ echo 'leetcode_problems_cleanup/' >> .gitignore
$ touch problems/
$ git add .
$ git commit -m 'first commit'
$ git remote add origin
$ git push -u origin master

My credentials are stored in my osx keychain.


Have you taken a look at our network troubleshooting documentation? If you need to use the GitHub Debug site, please send in the results directly to private support via the link provided in the documentation.

Let us know if you have more questions.

use git push -f master origin.It worked for me but i hope it may work for u too folk.

1 Like

same problem brother :cry: :cry:

Hello vishrutarya,
did you solve your problem? I have same and I have stuck. I have done same like you on top but still can’t push my first repository to github.
I will be grateful for the hint.
Best regards

Again Me,
I solved my problem used these comands:
First of all need to check that you are logged:
$ git config --global "Your user name on github in quotes "
$ git config --global your e-mail which you use on github@...

Next i added file:
echo "# pierwszyprojekt" >>
$ git add

I using Windows so need add command:
$ git config --global core.autocrlf true

Then I added my commits:
$ git commit -m "first commit"

Next change master for main branch:
$ git branch -M main

Conected to on-line repository:
$ git remote add origin https:/.....

And then after push it, my firts repository was done:
$ git push -u origin main

If someone have same problem can use these soltion, maybe will help.