2016-05-13 9 views
1

githubのリモートリポジトリへの変更をプッシュできません。私は、この認証エラーを取得:認証の問題、複数のユーザ、git、github、terminal、osx

remote: Permission to newuser/repository.git denied to olduser. fatal: unable to access ' https://github.com/newuser/repository.git/ ': The requested URL returned error: 403

(私は私の実際のユーザー名とリポジトリを置き換え) 私は新しいアカウントにプロジェクトを移行することだし、gitのは、私の古いユーザーの資格情報を使用して認証しようとしています。 グローバル 'user.name'(これは 'olduser')の設定を解除し、ローカル 'user.name'を 'newuser'に設定しました。今私のconfigsは、次のようになります。

core.editor=Sublime 
filter.lfs.clean=git-lfs clean %f 
filter.lfs.smudge=git-lfs smudge %f 
filter.lfs.required=true 
push.default=simple 
core.repositoryformatversion=0 
core.filemode=true 
core.bare=false 
core.logallrefupdates=true 
core.ignorecase=true 
core.precomposeunicode=true 
remote.origin.url=https://github.com/newuser/repository.git 
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/* 
branch.master.remote=origin 
branch.master.merge=refs/heads/master 
user.name=newuser 

私も資格ヘルパーとしてosxkeychainを追加しようとしましたが、私は何も対処しているとは思いません。私はこれを解決する方法を知らない。

ありがとうございました!

答えて

1

git config user.nameは、認証とは関係ありません。コミットするときに正しい作者/コミッターを設定するのに役立ちます。

Updating credentials from the OSX Keychainが役に立ちますが、プッシュするときにgitが新しいユーザー名を使用するようにする必要があります。

ことがプッシュURLにその新しいユーザー名を埋め込むことであることを確認するためのトリック:

cd /path/to/my/repo 
git remote set-url origin https://[email protected]/username/repository.git 

次に押し再試行してください。

+0

は完全に機能しました。良い答えと説明をありがとう –