728x90
반응형

 

 

git 에 push를 아래와 같이 했을 때 

$ git push -u origin master

 

아래와 같은 에러가 뜨면서 실패했다고 뜨면 

Username for 'https://github.com': name
Password for 'https://seohee@github.com': 
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/name/name.git/'

 

설정하였던 origin을 삭제하고, 다시 git remote add origin "자신의 레포지토리" 를 설정해준다. 

$ git remote -v 
$ git remote remove origin 
$ git remote add origin git@github.com:user/repo.git  

 

 

 

 

 

 

이 때 레포지토리를 추가하고 git push 를 했는데 아래와 같은 에러가 발생할 경우

To http://~~~~~~~:~~~/seohee/name.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'http://~~~~~~~:~~~/seohee/name.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

 

git pull 을 통해 이미 push 하였던 레포지토리를 당겨주고서 다시 push 를 시도한다. 

$ git pull http://~~~:~~~/name/name.git
$ git push -u origin master

 

 

 

 

 

참고자료 1 : https://stackoverflow.com/questions/17659206/git-push-results-in-authentication-failed

 

Git push results in "Authentication Failed"

I have been using Github for a little while and I have been fine with git add, git commit, and git push so far with no problems. Suddenly I am having an error that says: fatal: Authentication Fa...

stackoverflow.com

 

728x90
반응형