Issues with git push when linking my local and GitHub repositories

On this exercise / article:
https://www.codecademy.com/paths/computer-science/tracks/cspath-cs-101/modules/learn-git-git-workflow-u/articles/f1-u3-git-setup

I am on step 6, and I have followed the instructions listed on GitHub for “…or push an existing repository from the command line”.

On GitBash my command line just keep processing. I’m not allowed to make any other commands, and when I try to exit GitBash it says:
"Process are running in session::
| WPID PID COMMAND
| 6860 707 "C:\Program Files\Git\mingw
| 752 706 "C:\Program Files\Git\mingw

To be clear, it, so far, hasn’t asked me for my GitHub username or password.
How can I be sure it’s doing anything, and if it is how long should I expect this to take?

1 Like

Hi @shaughtgun, it should not be taking that long. Just try to kill it, open a new window and just in case check if you have the latest version of git. Then try to run your commands again, commit and push to your repo to see how it goes.

@chrisgeek07, thanks for the reply. Yesterday I closed and restarted the process, even reinitialized git, just to be safe. The only step that I couldn’t redo, cuz of an error was as follows:

$ git remote add origin https://github.com/.../git_practice.git
git push -u origin mainerror: remote origin already exists.

To help troubleshoot, I’ll post everything I did today, which includes checking the correct version of Git.
Also, anything that involved my name or username I replaced with “…”

Hope this helps


...@LNV-NA3160 MINGW64 ~
$ git --version
git version 2.32.0.windows.1

...@LNV-NA3160 MINGW64 ~
$ cd git_practice

...@LNV-NA3160 MINGW64 ~/git_practice (main)
$ git init
Reinitialized existing Git repository in C:/Users/.../git_practice/.git/

...@LNV-NA3160 MINGW64 ~/git_practice (main)
$ git status
On branch main
nothing to commit, working tree clean

...@LNV-NA3160 MINGW64 ~/git_practice (main)
$ git log
commit e02557d269f77603763884deb38ee5dfffd99ae7 (HEAD -> main)
Author: ... <86392470+...@users.noreply.github.com>
Date:   Thu Jun 24 16:18:39 2021 -0500

    First commit

...@LNV-NA3160 MINGW64 ~/git_practice (main)
$ git remote add origin https://github.com/.../git_practice.git
git push -u origin mainerror: remote origin already exists.

...@LNV-NA3160 MINGW64 ~/git_practice (main)
$ git branch -M main

...@LNV-NA3160 MINGW64 ~/git_practice (main)
$ git push -u origin main

*Edited to make first set of code formatted properly.

Okay I see, it seems like you’ve already established your remote origin and created your main branch. So just try to go to your command line, cd to your git_practice directory, run git init, check your git status and then just do git push and see how it goes.

I tried that and got some kind of error. I’ll post the process and results below:

...@LNV-NA3160 MINGW64 ~
$ cd git_practice

...@LNV-NA3160 MINGW64 ~/git_practice (main)
$ git init
Reinitialized existing Git repository in C:/Users/.../git_practice/.git/

...@LNV-NA3160 MINGW64 ~/git_practice (main)
$ git status
On branch main
nothing to commit, working tree clean

...@LNV-NA3160 MINGW64 ~/git_practice (main)
$ git push
fatal: The current branch main has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin main


Hmm, that weird. Try to create a new repo, run git init again and push it to your remote origin and see if you get any errors again.

So I took your suggestion, and made a whole new directory / repository. I’ll post every step I did from start to finish. I ended with the same “error” (just a blank line with it continuously loading)

...@LNV-NA3160 MINGW64 ~
$ mkdir git_practice2

...@LNV-NA3160 MINGW64 ~
$ cd git_practice2

...@LNV-NA3160 MINGW64 ~/git_practice2
$ git init
Initialized empty Git repository in C:/Users/.../git_practice2/.git/

...@LNV-NA3160 MINGW64 ~/git_practice2 (master)
$ echo "Hello Git and GitHub" >> README.txt

...@LNV-NA3160 MINGW64 ~/git_practice2 (master)
$ git add README.txt
warning: LF will be replaced by CRLF in README.txt.
The file will have its original line endings in your working directory

...@LNV-NA3160 MINGW64 ~/git_practice2 (master)
$ git status
On branch master

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)
        new file:   README.txt


...@LNV-NA3160 MINGW64 ~/git_practice2 (master)
$ git commit -m "First commit"
[master (root-commit) 723888e] First commit
 1 file changed, 1 insertion(+)
 create mode 100644 README.txt

...@LNV-NA3160 MINGW64 ~/git_practice2 (master)
$ git status
On branch master
nothing to commit, working tree clean

...@LNV-NA3160 MINGW64 ~/git_practice2 (master)
$ git log
commit 723888e9b3303965f052786e25c9df5178d4d3a2 (HEAD -> master)
Author: ... <86392470+...@users.noreply.github.com>
Date:   Tue Jun 29 15:13:34 2021 -0500

    First commit

...@LNV-NA3160 MINGW64 ~/git_practice2 (master)
$ git push
fatal: No configured push destination.
Either specify the URL from the command-line or configure a remote repository using

    git remote add <name> <url>

and then push using the remote name

    git push <name>


...@LNV-NA3160 MINGW64 ~/git_practice2 (master)
$ git remote add origin https://github.com/.../git_practice2.git

...@LNV-NA3160 MINGW64 ~/git_practice2 (master)
$ git branch -M main

...@LNV-NA3160 MINGW64 ~/git_practice2 (main)
$ git push -u origin main

Also, I don’t know if it’s relevant, but in GitBash i tried running python3 just using the command python3 and got a similar interaction where it’d show a blank line and load continuously. Is it possible my GitBash is installed incorrectly, or something of that nature?

Hi, can you give me the link of your new repo ?

The GitHub link? if so, its:

Okay its empty…Well it seems like you did everything well, also it seems like you have 2 branches, Master and main. Which one is your main Master branch ? Try running git branch to see how many branches you have, if you have 2 then maybe try to run git checkout branch_name then run your git add remote origin then push and see how it goes.

Running git branch just shows
*main

Oh man ! Have you considered reinstalling Git ? Or if you have another PC or laptop to try this exercise on, because I can’t see whats wrong here, I did the exercise again and it was all good. This is the last thing I can think for now.

I have been learning and working on Codecademy during my downtime at work on my work computer. I’ll try reinstalling GitBash on here, and if that doesn’t work, I’ll try it on my home computer. I’m glad to see it’s nothing to do with the steps I’m performing.

1 Like

Alright, let me know if it works after reinstalling Git.

I’m reinstalling now, and is it possible that part of the problem is using MinTTY as opposed to windows default console window?

i know in the description of each option, this may explain why i couldn’t get python to run

I didn’t know that you were using an emulator, just give the windows default console a try. You’ve got nothing to lose !

Okay so that worked! Now that does lead me to another question. I thought from the Codecademy documentation, that I had to / should use Git Bash (the emulator I guess?) to learn and get used to commands used in BASH operating systems (linux, apple). Now these commands seem to be working but I’m no longer seeing the “$” at the beginning of every line. I guess my question is, as long as Git is installed on my windows computer, am I set up to follow the rest of the Codecademy material, while using cmd.exe?

I hope that makes some semblance of sense. And again thank you for helping me get my git repository working!

1 Like

Very good question, I use macOS and It comes with Terminal, so I don’t have to do much to get it to work. I think that it is probably recommended to use Git Bash if you’re operating on Windows as long as its working but if its not, cmd will still get the job done ! Well you can still try again with Git Bash on your home computer, it might as well work you never know…