Error doing push origin master on github

5

I'm having the following error in github when I'm going to push.

  

Please make sure you have the correct access rights   and the repository exists.

I created the repository and as I was already with the project I created, I did:

git remote add [email protected]:andredsn/ArquiteturaSoftware.git
git config --global user.name "andredsn"
git config --global user.email "[email protected]"  
git add .  
git commit -m "primeiro commit"
git push origin master  

On this last line you give the error. You probably are not finding the repository.

As the line:

git remote add [email protected]:andredsn/ArquiteturaSoftware.git >

add the remote via ssh, then I deleted it with:

git remote rm origim master  

I typed: gite remote -v and it does not have any repository, so I guess I removed it. But the error appears when I add the remote via https:

git remote add https://github.com/andredsn/ArquiteturaSoftware.git  

give the error:

 C:\projetos\ArquiteturaSoftware>git remote add https://github.com/andredsn/ArquiteturaSoftware.git
usage: git remote add [<options>] <name> <url>

    -f, --fetch           fetch the remote branches
    --tags                import all tags and associated objects when fetching
                          or do not fetch any tag at all (--no-tags)
    -t, --track <branch>  branch(es) to track
    -m, --master <branch>
                          master branch
    --mirror[=<push|fetch>]
                          set up remote as a mirror to push to or fetch from 

I wanted a command to show if I'm connected to github since we use git config --global user.name and git config --global user.email for our id.

    
asked by anonymous 18.03.2017 / 02:55

2 answers

3

You used the SSH URL ( [email protected]... ) to add the remote, so it looks for your key.

The HTTPS URL has this format:

https://github.com/andredsn/ArquiteturaSoftware.git

Then do:

$ git remote add https://github.com/andredsn/ArquiteturaSoftware.git

and it will start requesting username and password.

(do not forget to remove the SSH remote first)

    
18.03.2017 / 18:24
4

If you want to do this using HTTPS, follow the steps below:

  • $ git init : Do this already within the desired directory

  • $ git remote add -f origin https://github.com/andredsn/ArquiteturaSoftware.git

  • $ git add .

  • $ git commit -m "First commit - send project"

  • $ git push origin master

  • See Working With Remotes for more details

    EDIT: The error that is appearing there after editing your question is that you are not following the GIT syntax correctly. Here's how it should be:

    $ git remote add [<opões>] <nome> <url>
    

    In your case it would be step 2 as I mentioned above. See:

    $ git remote add -f origin https://github.com/andredsn/ArquiteturaSoftware.git

        
    18.03.2017 / 19:20