I am new to Git and I am trying to to push a Java project to Github using Git Bash.
This is what I did:
created a Blog repository in GitHub
in Git Bash
$ cd C:/Users/Alessandro/workspace/BLOG
$ echo "# Blog" >> README.md
$ git add –-all
$ git commit -m "Initial commit"
$ git remote add origin https://github.com/alerossi82/Blog
$ git push -u origin master
But when I do the push, this is the result I get:
fatal: unable to access 'https://github.com/username/repository/': The requested URL returned error: 400
I read somewhere this is could be a login problem, but I checked my config in GitBash and the username and email match with GitHub. When I commit the push, I I am logged in to my GitHub account and I do not receive any insert password request from GitBash.
Then I tried to push the project directly from Eclipse, but this failed as well, in fact when I push the changes I receive the message: - master >> master [rejected - non-fast-forward]
I am totally lost, I think all the step are correct however it looks like my local and remote repositories don't want to talk to each other, and I have no idea why.
Any help?
Had a similar problem and it turned out that I had some issues with my .gitconfig
file since I had earlier run git config --global url."[email protected]:".insteadOf "https://github.com/"
and later git config --global url."https://github.com/".insteadOf "[email protected]:"
which added both lines to my .gitconfig file. So all I did was clean my .gitconfig file using vim in my terminal(Iterm)
:
$ vi $HOME/.gitconfig
Then removed the unwanted lines from the .gitconfig
file using vim editor. Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With