Error when pushing to Github

Asked

Viewed 8,696 times

4

I need to perform a push of files from my machine to Github but I’m not getting.

I leave below some lines of code that I used in cmd trying to accomplish the commit, push, git init and everything everyone says but nothing worked:

> git remote add origin [email protected]:gabriegsti/C

> git status
On branch master
nothing to commit, working tree clean

> git add *

> git status
On branch master
nothing to commit, working tree clean

> git commit -m "aqui coloco uma mensagem, tipo: comitando primeiro post"
On branch master
nothing to commit, working tree clean

> git push -u origin master
The authenticity of host 'github.com (192.30.253.112)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

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

> ssh-keyscan github.com >> ~/.ssh/known_hosts
O sistema não pode encontrar o caminho especificado.
  • 3

    You’re on Windows, do you check? You installed git as? From the last command you posted, the system did not detect the presence of the executable called ssh-keyscan. The failure was that you did not create your SSH key on your machine and did not send the public part to Github

  • Possible duplicate of Generate ssh key in git

2 answers

4


Welcome to en.stackoverflow.com.
Starting from the premise that you have made the configuration of SSH(key step in using Git) on your machine with the repository Git.

Let’s look at your scenario and the sequence of commands you used.

 1. git remote add origin
 2. git status
 3. git add *
 4. git commit -m "sua mensagem de commit"
 5. git push -u origin master

1. Possibly yours git remote did not establish a synchronization between your local repository and the remote, note that remote links have the extension .git at the end of his path, unlike your([email protected]:gabriegsti/C). To verify that the repository has actually been synchronized, use the command git remote -v and see if the origin was displayed along with its destination.

2/3. Before commiting your change it is valid to check which files have been modified(git status) and (git add *) to add them to the status of staged, perfectly correct before performing the commit. Pórem, note that the Git still helps you by giving a help message warning that there is no changed file(Nothing to commit, Working Tree clean), probably because it does not maintain synchronism provided by step 1.

4. Note that there is nothing to be committed, once again and the Git try to warn him(Nothing to commit, Working Tree clean).

5. The message related to push, is referring to key configuration SSH, you can perform the connection test to analyze your severity. Indico realize the following steps. And also check in your scenario if it is really necessary to use the parameter -u in his push.

Make sure the above description is in accordance with your environment and remember to make the initial and necessary settings to start with Git. As you yourself mentioned that you don’t know much about this technology, I suggest you take a look here and here.

  • When you use "git remote -v" inside the folder I want to send my work to, it shows me the right repository in git hub. Then I passed step 2, the status still has the response of "Nothing to commit Working Tree clean".

  • 1

    That message nothing to commit working tree clean, indicates that the Git did not identify any changes in your repository.

  • Then I passed step 5, got the following reply: C: Users Gabriel Desktop College study_em_c>git push origin master Warning: Permanently Added the RSA host key for IP address '192.30.253.113' to the list of known hosts. [email protected]: Permission denied (publickey). fatal: Could not read from remote Repository. Please make sure you have the correct access Rights and the Repository exists.

  • Note: I went to search more about ssh, but I think I set this at the beginning of the installation, at least the directory with this key is in my users. I would like to know if there is any relation of names or folders with git because I have a folder on my pc that is "estudo_com_c" that has git init(.git) because I ran inside it, and I have a repository that I created by github called "C" only. But how I created the two separate and both have different names. I wondered if that might be the problem.

  • you do not need to search, you did everything I recommended in my reply(including accessing and analyzing the links that are there)?

  • Yes, even when I used "git remote -v" the right orgin.

  • Do you remember configuring your GitHub with the access key SSH who created?

  • I do not remember. I only noticed that it exists. Unfortunately for lack of knowledge I did not pay attention to this part at the time I installed.

  • Let’s do the following, I’ll invite you to chat ok?

Show 5 more comments

4

A possible solution would be to authenticate via http and not ssh.

Example:

On your repository page, do the following, select https and copy the url.

inserir a descrição da imagem aqui

After copying, update the url from the remote repository.

git remote set-url origin https://github.com/renantins/test.git

When to perform the push, you will need to include your Github user and password.

  • Definitely not the answer I’d expect to see, hahaha!

  • @Jeffersonquesado :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.