The requested url returned error 403 github что делать

If you're having trouble cloning a repository, check these common errors.

HTTPS cloning errors

There are a few common errors when using HTTPS with Git. These errors usually indicate you have an old version of Git, or you don’t have access to the repository.

Here’s an example of an HTTPS error you might receive:

> error: The requested URL returned error: 401 while accessing
> https://github.com/USER/REPO.git/info/refs?service=git-receive-pack
> fatal: HTTP request failed
> Error: The requested URL returned error: 403 while accessing
> https://github.com/USER/REPO.git/info/refs
> fatal: HTTP request failed
> Error: https://github.com/USER/REPO.git/info/refs not found: did you run git
> update-server-info on the server?

Check your Git version

There’s no minimum Git version necessary to interact with GitHub, but we’ve found version 1.7.10 to be a comfortable stable version that’s available on many platforms. You can always download the latest version on the Git website.

Ensure the remote is correct

The repository you’re trying to fetch must exist on GitHub.com, and the URL is case-sensitive.

You can find the URL of the local repository by opening the command line and
typing git remote -v:

$ git remote -v
# View existing remotes
> origin  https://github.com/ghost/reactivecocoa.git (fetch)
> origin  https://github.com/ghost/reactivecocoa.git (push)

$ git remote set-url origin https://github.com/ghost/ReactiveCocoa.git
# Change the 'origin' remote's URL

$ git remote -v
# Verify new remote URL
> origin  https://github.com/ghost/ReactiveCocoa.git (fetch)
> origin  https://github.com/ghost/ReactiveCocoa.git (push)

Alternatively, you can change the URL through our
GitHub Desktop application.

Provide an access token

To access GitHub, you must authenticate with a personal access token instead of your password. For more information, see «Creating a personal access token.»

If you are accessing an organization that uses SAML SSO and you are using a personal access token (classic), you must also authorize your personal access token to access the organization before you authenticate. For more information, see «About authentication with SAML single sign-on» and «Authorizing a personal access token for use with SAML single sign-on.»

Check your permissions

When prompted for a username and password, make sure you use an account that has access to the repository.

Tip: If you don’t want to enter your credentials every time you interact with the remote repository, you can turn on credential caching. If you are already using credential caching, please make sure that your computer has the correct credentials cached. Incorrect or out of date credentials will cause authentication to fail.

Use SSH instead

If you’ve previously set up SSH keys, you can use the SSH clone URL instead of HTTPS. For more information, see «About remote repositories.»

Error: Repository not found

If you see this error when cloning a repository, it means that the repository does not exist or you do not have permission to access it. There are a few solutions to this error, depending on the cause.

Check your spelling

Typos happen, and repository names are case-sensitive. If you try to clone git@github.com:user/repo.git, but the repository is really named User/Repo you will receive this error.

To avoid this error, when cloning, always copy and paste the clone URL from the repository’s page. For more information, see «Cloning a repository.»

To update the remote on an existing repository, see «Managing remote repositories».

Checking your permissions

If you are trying to clone a private repository but do not have permission to view the repository, you will receive this error.

Make sure that you have access to the repository in one of these ways:

  • The owner of the repository
  • A collaborator on the repository
  • A member of a team that has access to the repository (if the repository belongs to an organization)

Check your SSH access

In rare circumstances, you may not have the proper SSH access to a repository.

You should ensure that the SSH key you are using is attached to your personal account on GitHub. You can check this by typing
the following into the command line:

$ ssh -T git@github.com
> Hi USERNAME! You've successfully authenticated, but GitHub does not
> provide shell access.

If the repository belongs to an organization and you’re using an SSH key generated by an OAuth App, OAuth App access may have been restricted by an organization owner. For more information, see «About OAuth App access restrictions.»

For more information, see Adding a new SSH key to your GitHub account.

Check that the repository really exists

If all else fails, make sure that the repository really exists on GitHub.com!
If you’re trying to push to a repository that doesn’t exist, you’ll get this error.

Error: Remote HEAD refers to nonexistent ref, unable to checkout

This error occurs if the default branch of a repository has been deleted on GitHub.com.

Detecting this error is simple; Git will warn you when you try to clone the repository:

$ git clone https://github.com/USER/REPO.git
# Clone a repo
> Cloning into 'repo'...
> remote: Counting objects: 66179, done.
> remote: Compressing objects: 100% (15587/15587), done.
> remote: Total 66179 (delta 46985), reused 65596 (delta 46402)
> Receiving objects: 100% (66179/66179), 51.66 MiB | 667 KiB/s, done.
> Resolving deltas: 100% (46985/46985), done.
> warning: remote HEAD refers to nonexistent ref, unable to checkout.

To fix the error, you’ll need to be an administrator of the repository on GitHub.com.
You’ll want to change the default branch of the repository.

After that, you can get a list of all the available branches from the command line:

$ git branch -a
# Lists ALL the branches
>   remotes/origin/awesome
>   remotes/origin/more-work
>   remotes/origin/new-main

Then, you can just switch to your new branch:

$ git checkout new-main
# Create and checkout a tracking branch
> Branch new-main set up to track remote branch new-main from origin.
> Switched to a new branch 'new-main'

Решение ошибки remote: Permission to user/repo denied to user/other-repo. fatal: unable to access user/repo: The requested URL returned error: 403

Дата: 27.03.2017

В данном уроке рассмотрим варианты решения данной оишбки:

remote: Permission to user/repo denied to user/other-repo.
fatal: unable to access user/repo: The requested URL returned error: 403

Возникает она чаще всего у новичков при попытке выполнить команду:

$ git push

Пример ошибки на скриншоте ниже.

git-permission-to-denied-to-error-403.jpg

Данная ошибка возникает довольно часто при работе с Git в терминале Windows. Суть ошибка довольно таки простая, но почему-то в интернете постоянно создаются темы с вопросом на данную тему и нет внятного ответа на русском языке.

Ошибка говорит нам о том, что мы пытаемся отправить данные в чужой репозиторий. И о том, что текущий пользователь Git не имеет прав для отправки данных в указанный в команде репозиторий.

Существует два способа решить данную ошибку:


Вариант 1. Дать текущему пользователю права для работы с репозиторием

Данный способ подойдет, если вы являетесь владельцем обеих учетных записей указанных в ошибке. Необходимо зайти на GitHub под именем того пользователя, в чей репозиторий вы не можете отправить данные. В настройках репозитория указать необходимого соавтора. Ему на почту отправится приглашение, которое необходимо подтвердить, перейдя по ссылке в письме.

github-repo-config.jpg

После этого вы сможете работать с репозиторием как со своим и ошибка больше не появится.


Вариант 2. Назначить в системе текущим пользователем Git ту учетную запись, в которую не можете отправить данные

Для этого необходимо перейти в Панель управления Windows. Выбрать отображение в виде категорий.

win-panel.jpg

Перейти в раздел “Учетные записи пользователей и семейная безопасность”. Далее в раздел “Диспетчер учетных данных”. В самом низу будет блок “Общие учетные данные”. Нажмите в нем ссылку “Удаление из хранилища”.

delete-git-config.jpg

После этого при попытке выполнить команду:

$ git push -u origin master

Терминал запросит у вас пароль от учетной записи на Github в чей репозиторий вы пытаетесь отправить данные.

После ввода пароля система установит данного пользователя как основного и будет использовать его в дальнейшем при работе с Git.


Надеюсь данный пост поможет вам решить ошибку, с которой я разбирался почти сутки.

git

github


Не забудьте сказать спасибо. Поставьте лайк!

This article discusses a problem that may occur when you try to push to a remote GitHub repository using HTTPS from an A2 Hosting server.

Table of Contents

  • Problem
  • Cause
  • Resolution
    • Method #1: Use SSH
    • Method #2: Modify the HTTPS URL

Problem

When you try to push changes to a GitHub repository from an A2 Hosting server using an HTTPS URL, you receive the following error message:

error: The requested URL returned error: 403 Forbidden while accessing https://github.com/github-username/github-repository-name.git/info/refs

Cause

There are a few possible causes for this problem:

  • You typed an incorrect password. Make sure you are using the correct GitHub password for the account.
  • The Git client on the A2 Hosting server requires a modified HTTPS URL to work correctly. If this is the cause, the password prompt does not even appear when you try to do a push operation.

Resolution

If you are sure you are using the correct GitHub password, there are two ways to resolve the “403 Forbidden” problem:

Method #1: Use SSH

Instead of using HTTPS URLs to push changes to GitHub, you can use SSH instead. For information about how to do this, please visit https://help.github.com/articles/changing-a-remote-s-url.

Method #2: Modify the HTTPS URL

Some A2 Hosting managed servers have an old version of the Git client installed. To push changes to GitHub using this older client version, you must include your GitHub username in the HTTPS URL.

To do this, follow these steps:

  1. Log in to your A2 Hosting account using SSH.
  2. At the command prompt, change to the directory where the Git repository is located.
  3. Type the following command:
    git config -l | grep url

    You should see output that resembles the following:

    remote.origin.url=https://github.com/github-username/github-repository-name.git
  4. You need to add your GitHub username to the github.com portion of the URL. To do this, type the following command, replacing the values in red with your own account information:

    git remote set-url origin "https://github-username@github.com/github-username/github-repository-name.git"
    
  5. To verify the new remote URL setting, type the following command:

    git config -l | grep url
    

    Now when you try to push changes to the GitHub repository, you are prompted for a password, and the push operation should succeed.

While working with Github you may face that, Git is saying 403 when trying to perform the git push origin master command. This fatal error occurs because password authentication for accessing Github’s private repository has been disabled. The error looks like,

fatal: unable to access 'https://github.com/username/location.git/': The requested URL returned error: 403

If you are struggling with the error here is a quick solution for you.

Step 1: Create Personal Access Token on Github

  • Log in to your GitHub account
  • Click on the Profile logo on the top right corner
  • Click on Settings
  • Then, Click on Developer settings for the left sidebar
  • Next, Click on Personal access tokens for the left sidebar
  • After that, Click on Generate new token
  • Give your token a descriptive name on the Note field
  • Select Expiration time and preferred scopes
  • Click on Generate token
  • Finally, you can copy that token and use it to authenticate. You can use the token instead of a password for Git over HTTPS or can use it to authenticate to the API over Basic Authentication.

Step 2: Use Personal Access Token for Authentication

Using HTTPS URL

Personal access tokens can only be used for HTTPS Git operations. Once you have a token, you can enter it instead of your password when performing Git operations over HTTPS. For the existing remote repository, you need to update the remote URL by using,

$ git remote set-url origin https://[githubtoken]@github.com/[username]/[repositoryname].git
$ git push origin master

Or, while cloning any repository,

$ git clone https://github.com/username/repo.git
Username: Enter your username
Password: Enter your access token
Using SSH

For performing Git operation you just need to change the URL. First, make sure your SSH keys are correctly set up. Then, To update the URL you have to run

$ git remote set-url origin git@github.com:[username]/[repositoryname].git
$ git push origin master

Thank you for reading the article. Hope following the steps properly will solve your problem.

But if still, you are facing a problem to generate or use your Personal Access Token and perform Git Operations you can read this article with details step by step process.

Error Description:

  • We can clone a copy of this repo over HTTPS authenticated.
  • We have made some commits and want to come back to the GitHub server. Using Cygwin on Windows 7 x64.
C:cygwinhomeXPheriorCodelunch_call>git push
Password:
error: The requested URL returned error: 403 while accessing https://MichaelDrog
[email protected]/derekerdmann/lunch_call.git/info/refs

fatal: HTTP request failed

Solution 1:

Github give the idea it supports ssh way to read & write the repo, whereas https way also displayed ‘Read & Write’.

  • Now you need to change your repo config on your PC to ssh way:

1. Edit .git/config file under your repo directory
2. Find url=entry under section [remote "origin"]
3. Change it from url=https://[email protected]/derekerdmann/lunch_call.git to url=ssh://[email protected]/derekerdmann/lunch_call.git. ie, change all the texts before @ symbol to ssh://git
4. Save config file and quit. You can use git push origin master to sync your repo on GitHub

Solution 2:

  • To login using https protocol, you should first set your authentication credential to the git Remote URI:
  • Now you’ll be asked for a password when try to git push.
  • In fact, this is on the http authentication format. Now you have to set a password :
  • You should be aware that your github password will be stored in plaintext in your .git directory, which is undesirable.

Solution 3:

  • On behalf of editing .git/config file manually, you can use git remote set-url command.
  • In your case it should be:

Solution 4:

  • Edit .git/config file under your repo directory
  • Find url= entry under section [remote "origin"]
  • Change it from url=https://github.com/rootux/ms-Dropdown.git to https://[email protected]/rootux/ms-Dropdown.git
  • Where USERNAME is your github user name

Solution 5:

  • When permission denied 403 error while using ssh(according to Xiao) or http urls you can also try these commands
git config --global --unset-all credential.helper

git config --unset-all credential.helper

With administrator rights

git config --system --unset-all credential.helper

UP NEXT IN GIT

  • Git Tutorial
  • Git Interview Questions and Answers
  • Git HR Interview Questions and Answers
  • Git Sample Resume
  • Git Interview Dress Code
  • Git Job Apply Letters
  • Git Forums

Remote: Permission to UserName/repo.git denied to OtherUserName fatal: unable to access ‘https://github.com/UserName/repo.git/’: The requested URL returned error: 403

February 6, 2020 08:47PM

I was working on the one of the clients project hosted on github.com, I cloned the repo locally added few files to local repo and staged/committed project locally all was good.

git add .
git commit -m 'test'

But when tried to push the changes on remote repo on github.com. I was receiving below error. 

git push origin master
remote: Permission to UserName/repo.git denied to AnotherUserName.
fatal: unable to access 'https://github.com/UserName/repo.git/': The requested URL returned error: 403

Powershell visual studio code vscode git add git commit -message git push origin git remove permission denied the requested URL returned error 403.png

This error says that you are using wrong credential or wrong repo: the fact is when you are pushing its not asking for credentials, below are the possible reasons.

  1. Username needs to be the user, not the email
  2. Ensure you provide the proper password. If you have 2FA enabled on GitHub, you need to make sure you create an Access Token with proper access permissions and use the token as password instead.
  3. Repo format is: https://github.com/<user>/<repo>.git
  4. You have 2 different github (version control) accounts

403 means GitHub is not granting you access so one or more of the 4 above cause are the problem. In my case this issue happened due to I have one personal github account  and second received from client. Until now I was using my github account and in the past when I did push for the first time it asked my github credentials which got saved/ cached in windows credential manager, and today for the first time when I am using second account it is using username and password cached earlier for previous github account, causing access denied error.

You can solve this problem by using few methods. But below simple method helps you to solve the issue.

step 1: Go to Control Panel.
step 2: In the control panel find and go to user accounts
step 3: After that go to credential manager
step 4: Then Windows credentials
step 5: Go to Generic credentials, and search github.com, expand it
step 6: Finally delete the Github keys.

git error 403 remote access denied control panel user accounts credential manager git git hub remove generic windows credentials persistence git push origin master.png

Once cached credentials are removed, try pushing project on remote by running command git push origin master, This will prompt for GitHub login prompt, once the authentication is successful with correct username and password, command will succeed and files/folders are pushed successfully on remote github repo.

git push origin master git error 403 remote access denied another user control panel user accounts credential manager git github remove generic windows credentials persistence.png

If you don’t want to remove previous users credentials from windows credentials manager another way to resolve this issue is give previous user access over new github.com repo.

Useful Article
Solved Visual studio Code make sure you configure your user.name and user.email in git
Part 1 Git version control integration in Visual Studio Code
Part 2 Git master branch source control integration in Visual Studio Code
Part 3 Git clone version control integration in Visual Studio Code

Go Back

After a long time I created a repo on my Github account.Creating a repo is quite easy on Github, simply login to your account and click on ‘create repo’ button. After creating git repo, now it was time to push all my codes from my desktop to github repo.

After cloning the repo into my system, I copied all my coded into git cloned directory. And tried to push my code into gtihub repo. But got the error message “error: The requested URL returned error: 403 Forbidden while accessing https://github.com/sharadchhetri/skctheme.git/info/refs

The error was quite clear that the problem was with URL. I again used my old generic steps for git. Finally it is solved and all codes are successfully pushed into github repo.

In below section, I am writing step by step how I pushed the code in Github repo successfully
Follow the given below steps from where(Desktop/Server) you want to push the code into Github repo :

Step 1: Clone the github repo into your system. (You should first create a repo in Github)

Get repo url at right hand sidebar of your repo page. Replace your github repo’s HTTPS url with https://github.com/USER-NAME/REPO-NAME.git

git clone https://github.com/USER-NAME/REPO-NAME.git

For EXAMPLE:

git clone https://github.com/sharadchhetri/testrepo.git

After cloning will be finished, you will find the directory name matching with the name of Github repo name you just cloned.

Step 2 : Copy your code or files to REPO-NAME directory

For example, I have saved my codes in my desktop at /home/sharad/MyCode directory. Here, I am copying all codes and child directories into REPO-NAME directory .

cp -rvf /home/sharad/MyCode/* /home/sharad/testrepo

Step 3 : Change to git cloned directory i.e REPO-NAME.

cd REPO-NAME

Step 4 : Set Github account username and email id for authentication

git config --global user.email "your-email-id@example.com"
git config --global user.name "Your-Github-UserName"

Step 5: Set Github URL. (This section is actually solution of this problem)

git remote set-url origin https://Your-Github-UserNAme@github.com/Your-Github-UserNAme/REPO-NAME

For EXAMPLE.

git remote set-url origin https://sharadchhetri@github.com/sharadchhetri/testrepo.git

Step 6: Now add all files and directory by using below given command inside REPO-NAME directory
(There is a dot in command, can you see that!)

git add .

Step 7: Now write comment on commit

git commit -m 'my first commit'

Step 8: Now push the code in Github repo.
Be ready with your github account password because it will ask.

git push -u origin master

I hope the solution also work for you.

Понравилась статья? Поделить с друзьями:
  • The requested url returned error 403 git push
  • The requested url returned error 401 unauthorized
  • The requested url returned error 400 git
  • The requested url returned error 400 bad request
  • The requested content cannot be loaded please try again later как исправить