Git

When git doesn't push at last step(Could not read from remote repository)

Naranjito 2024. 1. 17. 11:24
  • Error : When I tried to push the file into the github, it stoped the last step. 

It doesn't give me any result after 'Total 3 (delta 0), reused 0 (delta 0), pack-reused 0'.

(sensor_fusion) Joohyuns-MacBook-Pro:Geometric_transformations joohyunyoon$ git commit -m 'add file'
[main (root-commit) 15531cc] add file
 1 file changed, 1736 insertions(+)
 create mode 100644 Data augmentation.ipynb
(sensor_fusion) Joohyuns-MacBook-Pro:Geometric_transformations joohyunyoon$ git branch -M main
(sensor_fusion) Joohyuns-MacBook-Pro:Geometric_transformations joohyunyoon$ git remote add origin https://github.com/mellamonaranja/Data_Augmentation_Tensorflow.git
(sensor_fusion) Joohyuns-MacBook-Pro:Geometric_transformations joohyunyoon$ git push -u origin main
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 12 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 2.58 MiB | 756.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0

 

  • Solution

1. Try to push with SSH address, NOT HTTPS address.

$ git remote add origin https://github.com/mellamonaranja/Data_Augmentation_Tensorflow.git

 

1-1. Error

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:uNiVztksCsDhcc0u9e8BujQXVUpKZIDTMczCvj3tD2s.
Please contact your system administrator.
Add correct host key in /Users/joohyunyoon/.ssh/known_hosts to get rid of this message.
Offending RSA key in /Users/joohyunyoon/.ssh/known_hosts:1
Host key for github.com has changed and you have requested strict checking.
Host key verification failed.
fatal: Could not read from remote repository.

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

 

1-2. Error

The authenticity of host 'github.com (20.200.245.247)' can't be established.
ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

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

 

1-2. Solution

1) Remove the current ssh key.

$ cd ~/.ssh
$ rm known_hosts

 

2) Check the github.pub key.

$ cat github.pub 
ssh-ed25519...joohyunee.y@gmail.com

 

3) Copy and Attatch it to the github SSH keys.

 

4) Git Push the file to the github again.