i am having problems with pushing my local repository to my remote repository.
(GingerToe is my personal account and BananaOak is my account i made under university email)
i am getting a weird error of clashing credentials . till now i tryed to remove my bananaOak account but when i tryed pushing my file using my Ginger credentials with the command
$ git config --global user.name "GingerToe"
$ git config --global user.email "[email protected]"
but i am getting the error of
$ git push -u origin main
remote: Permission to GingerToe/ML-Practice.git denied to BananasOak.
fatal: unable to access '.git/': The requested URL returned error: 403
i am having problems with pushing my local repository to my remote repository.
(GingerToe is my personal account and BananaOak is my account i made under university email)
i am getting a weird error of clashing credentials . till now i tryed to remove my bananaOak account but when i tryed pushing my file using my Ginger credentials with the command
$ git config --global user.name "GingerToe"
$ git config --global user.email "[email protected]"
but i am getting the error of
$ git push -u origin main
remote: Permission to GingerToe/ML-Practice.git denied to BananasOak.
fatal: unable to access 'https://github/GingerToe/ML-Practice.git/': The requested URL returned error: 403
Share
Improve this question
asked Apr 1 at 3:04
Anas KhanAnas Khan
12 bronze badges
1
|
2 Answers
Reset to default 1Case 1: No Write Access
This seems like the account you are trying to push from does not have a write access to that repository.
You need to add that account as a "collaborator" to the repository: by going to {your_repo}/settings/access
and "Add People".
Case 2: Lack of Authentication
If this does resolve: then it might be a case of lack of verification, which could be solved by adding a PAT (personal access token) on GitHub, by going to https://github/settings/tokens.
Instead of using your actual password (when prompted) use your PAT.
Managing PAT
Using PAT in Command Line
If you have different repositories that require authentication using a different account, you can update the configuration to store which exact account to use. If you have a Git Credential manager installed, it should pick up that setting to automatically switch between authentication tokens.
There are a few options, most common are:
- GitHub CLI - run
gh auth setup-git
- Git Credential Manager
To configure the correct username to use, you can run the following command:
cd ML-Practice
git config credential.username GingerToe
Or save it globally for all repos under that account:
git config --global credential.https://github/GingerToe.useHttpPath true
git config --global credential.https://github/GingerToe.username GingerToe
These credential managers can also pick up the user context from the remote configuration. You can add in the username at clone time, or set the specific username for an already cloned repository by changing the remote url.
If you do not have a credential manager installed, this will not work, as it won't be able to find the corresponding password/access token. Adding the access token to the remote url is considered a bad practice, as it stores the token on your harddrive without encryption.
If you want a specific repo to use a specific username, you can also include the username when cloning the repo:
git clone https://[email protected]/GingerToe/ML-Practice.git
This will store the username to use in the remote config.
Or update the remote to include the username. To later change that on an already cloned repo, you can use:
git remote set-url origin https://[email protected]/GingerToe/ML-Practice.git
Ginger credentials with the command
note that these config options have nothing to do with repo permissions. They only change the user name and email used when you commit. – AD7six Commented Apr 1 at 8:34