Home > Enterprise >  First time Git user, Push to remote repository takes forever
First time Git user, Push to remote repository takes forever

Time:11-18

Win 10, using Git bash. Git version 2.32.0.windows.1. Researched similar/same topics, they didn't help.

I'm a new user of Git, trying to learn how to use it, never used version control systems before, and I don't have anyone fleshy to ask or show me.

I follow the tutorial and even understand what's going on so far, but the push to the remote repository takes forever and does nothing. Everything up to that point worked.

Tutorial I'm using: YouTube Link with timestamp

What I successfully managed to do: created my first local repo, created dummy test file (took a random script for PCB CAD program with a bit of text, doesn't matter I guess), learned to create a branch and commit stuff to local branches. My head is about to explode, but it works, and I understand it so far. But pushing to remote repo hangs without giving any hint or clue.

I did a bit of research and found this topic here on StackOverflow: link

I added --verbose to the push command, so now it looks like this:

$ git push -u --verbose origin main
Pushing to https://github.com/ellectroid/test_public_repository.git

And then it hangs forever. Highly uninformative.
Also, in the stackoverflow post in the link above someone talks about protocols. I tried http and https. No difference.

Then someone (goes by Azeez) said to ensure I'm authenticated on GitHub. Well, I'm logged in in the browser, although I don't understand how that is connected, but I'm logged in. And then in the same post they write some quote:

Select an authentication method for 'https://github.com/':

  1. Web browser (default)
  2. Personal access token option (enter for default):

I have zero clue what this is, I was never asked to authenticate anything in the bash, and I have no clue how to do it. The tutorial doesn't do it and everything works there out of the box.

I'm a 100% Git and GitHub noob, registered an account like half a year ago, but today is my first day of actually trying to use it, and I immediately get this in the face without any clue as to why and what to do, so I would appreciate if your reply explained what to do in detail. I just want to be able to push what I have in my local repo to the GitHub.

I'm not using any proxy or anything, if that matters.

If you need more information from me, please tell me what information and where do I get that information. As I said, I don't know anything about Git yet, but very much want to.

P.S. I'm aware about master and main branch names and accounted for it.

UPDATE

On the next day when I tried to push, a Git GUI popped up with openSSH in window title asking me for GitHub username. I entered my username, which was for some reason all with asterisks (never seen login written with asterisks), I entered my GitHub username "ellectroid" and got "Application error" window with text "Error: error writing "stdout": broken pipe". I opened detailed error message, it says:

    error writing "stdout": broken pipe
error writing "stdout": broken pipe
    while executing
"puts $::answer"
    (procedure "finish" line 14)
    invoked from within
"finish"
    invoked from within
".b.ok invoke"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 [list $w invoke]"
    (procedure "tk::ButtonUp" line 24)
    invoked from within
"tk::ButtonUp .b.ok"
    (command bound to event)

UPDATE 2 After extensive googling I found what person in the comments was talking about. Turns out there is a file with the name "config" without extension in the hidden folder .git in my local repo (was it difficult to explain like this? Sorry, I said I'm noob, you could word it friendlier for noobs), so here are the contents of this "config" file:

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
[remote "origin"]
    url = https://github.com/ellectroid/test_public_repository.git
    fetch =  refs/heads/*:refs/remotes/origin/*
[remote "origin2"]
    url = http://github.com/ellectroid/test_public_repository.git
    fetch =  refs/heads/*:refs/remotes/origin2/*

I tried origin2 to try with http instead of https. I still get error when authenticating on github in Git GUI OpenSSH window, where I enter my login with asterisks ("ellectroid") and it spews out broken pipe error like above.

UPDATE 3

Thanks to @VonC, who invited me to the chat, we figured out all I had to do is to push not from the Git Bash, but from Windows CMD. Then, when I push, it immediately prompted me to use Personal Access Token, which I already created. Also, I did it with admin rights. Later on I changed environment variable PATH to include path to bash, so I can just write "bash" in CMD and get fancy colors and stuff. Case closed.

CodePudding user response:

On Windows, try and push from the command-line (not from a GUI) to test if that would be working.

Make sure that, in a simple CMD:

  • git config credential.helper does return manager-core
  • git ls-remote https://github.com// triggers a popup where you can enter your GitHub user account name and your PAT (Personal Access Token that you need to create first)

Then try and git push from within your local repository folder.

From the discussion, this started to work with:

  • C:\Program Files\Git\bin, so you need to add it to the system PATH (it is where bash.exe is)
  • a CMD opened as Administrator
  • Related