0

I am currently learning how to create a repository using Git Bash and push it to GitHub.

You will see below my steps on Git Bash.

Before these steps I had set up my user name and email address on Git.

Where I get stuck is that after copying the command from GitHub ('..

or push an existing repository from the command line git remote add origin https://github.com/userName/git_test.git git branch -M main git push -u origin main ')

After I copied the command line from GitHub, nothing happens ...

The cursor keep clicking for ages , as no $ sign appears, after like 20 mn did Ctrl + C so i can write a command to check if it works (hence my second steps below)

The README.txt size is super small so I don't think that is the problem.

Is anyone has suggestion on why it doesn't work ?

Also it is my second try, I have created another repository git_practice which I would like to cancel but my computer won't let me as it says it is open on another program.

I HAVE REPLACED MY NAME WITH USERNAME

// FIRST STEPS : My steps on Git Bash :

username@LAPTOP-KCM8PO5E MINGW64 ~
$ pwd
/c/Users/username

username@LAPTOP-KCM8PO5E MINGW64 ~
$ mkdir git_test

username@LAPTOP-KCM8PO5E MINGW64 ~
$ cd git_test

username@LAPTOP-KCM8PO5E MINGW64 ~/git_test
$ git init
Initialized empty Git repository in C:/Users/username/git_test/.git/

username@LAPTOP-KCM8PO5E MINGW64 ~/git_test (master)
$ git add README.txt

username@LAPTOP-KCM8PO5E MINGW64 ~/git_test (master)
$ git commit -m "Add README.txt"
[master (root-commit) d3be350] Add README.txt
1 file changed, 1 insertion(+)
create mode 100644 README.txt

username@LAPTOP-KCM8PO5E MINGW64 ~/git_test (master)
$ git log
commit d3be3501277fae8bf66dee882df3285ade5f7efa (HEAD -> master)
Author: User Name<username@gmail.com>
Date: Thu Jun 17 19:22:22 2021 +0100

Add README.txt

username@LAPTOP-KCM8PO5E MINGW64 ~/git_test (master)
$ git remote add origin https://github.com/userName/git_test.git
git push -u origin main

username@LAPTOP-KCM8PO5E MINGW64 ~/git_test (master)
$ git branch -M main

username@LAPTOP-KCM8PO5E MINGW64 ~/git_test (main)
$ git push -u origin main

// SECOND STEPS: Nothing happened so after I typed Ctrl + C, the following showed:

username@LAPTOP-KCM8PO5E MINGW64 ~/git_test (main)
$ git push repo_url
fatal: 'repo_url' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

username@LAPTOP-KCM8PO5E MINGW64 ~/git_test (main)
$
0x5453
  • 12,753
  • 1
  • 32
  • 61
Sophie
  • 1
  • 2
  • does `git remote -v` show the correct remote? – ti7 Jun 17 '21 at 20:09
  • try [using ssh keys](https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh); https auth never seems to work well – ti7 Jun 17 '21 at 20:10
  • https://stackoverflow.com/questions/67931716/git-push-doesnt-do-anything-over-https#comment120072116_67931716 – phd Jun 17 '21 at 20:45
  • username@LAPTOP-KCM8PO5E MINGW64 ~/git_test (main) $ git remote -v origin https://github.com/username/git_test.git (fetch) origin https://github.com/username/git_test.git (push) – Sophie Jun 18 '21 at 23:05
  • Thank you everyone ! It is not fixed, but I have used Open in command prompt from GitHub desktop version (thank you php for the link) looks like it might be a bug. Hopefully this will be fixed at some point, at least I can use an alternative in the meantime. Althought, it was only for practice I just wanted to nip this thing in the head before being ready to push my future projects, otherwise this would have stressed me out !! – Sophie Jun 18 '21 at 23:37
  • *** UPDATE *** So I couldn't let it go ! So basically by switching my branch from master (as you can see above my branch is a master not a main) to main seemed to be the problem. "git branch -M main". So I have done it again by ignoring GitHub's command 'git branch -M main" and replacing "git push -u origin main" by "git push -u origin master". Is that weird I have enjoyed this type of investigation ? Ha !! – Sophie Jun 19 '21 at 13:20

0 Answers0