Git push error: requested URL returned 400 error

I am new to Git and I am trying to run a Java project on Github using Git Bash.

This is what I did:

  • created a Blog repository on 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 click, this is the result I get:

fatal: could not access https://github.com/username/repository/ ': The requested URL returned an error: 400

-, , GitBash GitHub. push, GitHub, GitBash.

Eclipse, , , , : - master → master [reject - non-fast-forward]

, , , , , , .

?

+5
4

 git add . -A

,


cd C:/Users/Alessandro/workspace/BLOG
echo "# Blog" >> README.md

# Here you need to run the git add command 
git add -A .

git commit -m "Initial commit"
git remote add origin https://github.com/alerossi82/Blog
git push -u origin master
0

.git, . URL -, GitHub, git. :

$ git remote add origin https://github.com/alerossi82/Blog.git

, , , URL- SSH HTTPS-url: $ git remote add origin git@github.com:alerossi82/Blog.git

, ssh , GitHub. GitHub urls .

0

, , , :

git status

- , , :

git add .

.

git commit -m "your commit message"

:

git push -u origin master
0

I had a similar problem, and it turned out that I had some problems with my file .gitconfigsince I had previously launched git config --global url."git@github.com:".insteadOf "https://github.com/"and later git config --global url."https://github.com/".insteadOf "git@github.com:"added both lines to my .gitconfig file. So all I did was clear my .gitconfig file using vim in my terminal (Iterm):

$ vi $HOME/.gitconfig

Then remove the unwanted lines from the file .gitconfigusing the vim editor. Hope it helps.

0
source

All Articles