0

I create a new repository. Clone it to a folder in my computer. Then create a txt file in that folder. When I try to push this changes $git push does not work. Even it does not produce any error message. By the way I am using gitbash.

I uninstall gitbash and reinstall it but nothing changes.

The code as follows:

~/Desktop/duke/890_r/final_project (main)
$ git status
On branch main
Your branch is ahead of 'origin/main' by 5 commits.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean

 ~/Desktop/duke/890_r/final_project (main)
$ git push

$git push does not produce any error message.

ysimsek
  • 1
  • 1
  • 2
    Could you please provide the full output of the command? – geobreze Jun 30 '21 at 20:49
  • 1
    And provide the exact commands you've run, don't just describe them. – mason Jun 30 '21 at 20:50
  • Where is the cursor after `git push`? If you press `Ctrl+C` is there any error? – phd Jul 01 '21 at 08:56
  • 2
    Does this answer your question? [After $git push -u origin main command, Git bash is not requesting any authentication literally does nothing](https://stackoverflow.com/questions/68057254/after-git-push-u-origin-main-command-git-bash-is-not-requesting-any-authentic) – matt Jul 01 '21 at 09:37

1 Answers1

0

you might wanna add origin main to the push command

> git push origin main

the reason is because the default branch was master but github has changed it to main so gitbash doesn't know what branch to push so you have to specify that you want to push the main branch

if you just want to use the master branch as the default make a new branch named master then set master as the default (Github guide) then you could delete the main branch (Delete branch)

or

You probably pushed into a non-bare repository, i.e. a repository that has a working copy attached to it. You shouldn’t have ignored the warning git push gives you if it notices that this is the case.

Anyway, log in to the remote machine, change to the repository and do

git checkout <whatever branch you’re on>

There you go. Next time only push into bare repositories.

imTurtle
  • 21
  • 1
  • 2