Git – Error – “remote: Permission denied”

Background

Wanting to contribute to a Git repository, but ran into an error.

Error

Error – remote: Permission denied.

Command

git push

Output

Textual


>git push
remote: Permission to [owner]/[repository].git denied to DanielAdeniji.
fatal: unable to access 'https://github.com/owner<span id="mce_SELREST_start" style="overflow:hidden;line-height:0;"></span>/[repository].git/': The requested URL returned error: 403

Remediation

Outline

  1. Review current targeted repository
  2. Create your own repository
  3. Return to pulled repository
  4. Change Targeted repository
  5. Push into new targeted repository

Tasks

Review Targeted repository

Read .git\Config

Please read the current content of the .git\config file

git.config.01.20191011.1200PM.PNG

Change Targeted repository

Please create your own repository using the web site is how I do mine.

I always lacked the strength to learn how to do so through the command line.

Return to pulled repository

Change Targeted repository

Choices

  1. Remove & Add
    • git remote remove & git remote add
    • — or —
    • git remote set-url [URL]
    • — or —
    • git config remote.origin.url [URL]
git remote remove & git remote add
Code

setlocal

set "_urlOriginal=https://github.com/[owner]/[repositoryOwner].git"

set "_urlSelf=https://github.com/[self]/[repositorySelf].git"

rem git remote rm [name of the url you sets on adding]

git remote rm %_urlOriginal%

rem git remote add origin https://github.com/[self]/[repositorySelf].git

git remote add origin %_urlSelf%

endlocal 

git remote set-url
Code
setlocal

set "_url=https://github.com/_self/_url"

git remote set-url %_url%

endlocal

git config url
Code
setlocal

set "_repository=https://github.com/[_self]/[_repository].git"

git config remote.origin.url %_repository%

endlocal

Change Targeted repository

Outline

  1. Git push
    • git push
Code

git push

Summary

Outline

  1. Earlier issued git clone to clone the repository.
  2. Attempt to push changes, but greeted with permission error, as I don’t have commit capacity
  3. Created new repository
  4. Changed target repository from original authorship to newly created repository
  5. Able to push into new repository

 

Referenced Work

  1. Stackoverflow
    • How can I change the remote/target repository URL on Windows? [duplicate]
      Link

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s