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

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

Problem:

git push -u origin master seems to hang.

That is, it doesn’t product output in the terminal, the github.com 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/1_two_sum.py
$ git add .
$ git commit -m 'first commit'
$ git remote add origin https://github.com/vishrutarya/leetcode.git
$ git push -u origin master

My github.com credentials are stored in my osx keychain.

2 Likes

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

https://medium.com/@danyalraja/easy-start-git-using-command-line-d95f8eb559d4

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 user.name "Your user name on github in quotes "
$ git config --global user.email your e-mail which you use on github@...

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

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.