6

I have just clone repo an then make one commit add it and was trying to push it - but have this error: enter image description here

Any ideas how can I fix this evill?

Rahil
  • 225
  • 1
  • 2
  • 8

5 Answers5

10

I had the same problem with my first GitHub repository just now. In my case, the problem was related to having enabled two-factor authentication. I had GitHub make an authentication token since the command line tools aren't aware of two-factor authentication.

The problem was that double-clicking the token to select it somehow selected a space to its left as well, resulting in me copying an invalid code. Carefully click-dragging from one end of the token to the other worked.

Mark Haferkamp
  • 763
  • 8
  • 10
  • 2
    For anyone else having trouble with multi-factor authentication on Github and logging in with git read http://stackoverflow.com/questions/21892226/can-i-use-githubs-2-factor-authentication-with-tortoisegit – Sean Bannister May 25 '15 at 21:09
6

If you have changed your password, you can use

git remote show origin

This will prompt for a username and password wherein you can enter your credentials.

Suraj
  • 407
  • 1
  • 8
  • 12
5

If you want to push to https://github.com/AntonDerenivsky/lado, you should use the credentials of AntonDerenivsky.

Using 'fresa' would only work if fresa has been declared as collaborator for AntonDerenivsky/lado repo.

Or you need to fork that repo, and use:

git remote rename origin upstream
git remote add origin  https://fresa@github.com/fresa/lado
git push -u origin master

If AntonDerenivsky is your gitHub account, the the login to use is 'AntonDerenivsky', not 'fresa'.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • resa@tkd:~/localgit/lado$ git remote rename origin upstream fresa@tkd:~/localgit/lado$ git remote set-url origin https://fresa@github.com/fresa/lado fatal: No such remote 'origin' fresa@tkd:~/localgit/lado$ git push -u origin master fatal: 'origin' does not appear to be a git repository fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. fresa@tkd:~/localgit/lado$ tryed to fork – Rahil Jul 28 '14 at 15:19
  • 1
    @Rahil I meant `git remote add`, not '`set-url`'. and that supposes you have forked the repo first on GitHub (https://help.github.com/articles/fork-a-repo). – VonC Jul 28 '14 at 15:20
  • how can I use my credentials) I'm not strong in git – Rahil Jul 28 '14 at 16:16
  • I was created lado repo and after that reinstal ubuntu - and now can't connect to it – Rahil Jul 28 '14 at 16:17
  • Did you fork the repo? Do you have a github account? What error message do you see now? – VonC Jul 28 '14 at 16:33
  • yes i did. AntonDerenivsy - my account , i'ts still shows me remote: Invalid username or password. fatal: Authentication failed for 'https://github.com/AntonDerenivsky/lado.git/' – Rahil Jul 28 '14 at 16:43
  • @Rahil then what is your GitHub account? – VonC Jul 28 '14 at 17:01
  • @Rahil then you need to enter AntonDerenivsky as your login, not 'fresa' – VonC Jul 28 '14 at 17:04
1

Regarding two factor authentication - after re-enabling 2fa I had to delete and re-add the remote endpoint for git to successfully pull.

# ERROR: Repository not found.
# fatal: Could not read from remote repository.
# copy and paste ssh destination git@github.com:user/repo.git

git remote -v 
git remote remove origin
git remote add origin git@github.com:user/repo.git
random-forest-cat
  • 33,652
  • 11
  • 120
  • 99
0

maybe you change your password. I has the same problem,then use upstairs method works. Remember to replace url git@github.com:user/repo.git by yourself.

git remote -v 
git remote remove origin
git remote add origin git@github.com:user/repo.git
Tomasz
  • 4,847
  • 2
  • 32
  • 41
lengqi
  • 11