I have generated an ssh key using the following
ssh-keygen -t rsa -C "your_email#example.com"
I have also added the ssh key to my github settings.
However, when I try and clone, I get this error message
Initialized empty Git repository in /home/somepath/.git/
error: The requested URL returned error: 403 Forbidden while accessing https://github.com/somelink.git/info/refs
fatal: HTTP request failed
The same works from another laptop though
you can't authenticate to github with ssh keys using https urls. You need to use ssh: url (docs)
Related
I configured the SSH based authentication as below
Created a public key on my UNIX server
Added the public key on my Bitbucket repository with reading and write privileges (also tried it at account level)
changed the URL from https to SSH at bitbucket and Unix server
verified the URL using and it is displaying SSH URL only
Then Tried to push, but I am getting the below error:
Permission denied (public key). fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
I have read and write access to the repository
push command
git push -u origin master
Any idea?
You should try:
GIT_SSH_COMMAND="ssh -Tv" git push
You will see what Git is using as an SSH key, and if there are any error messages.
If the error persists, it is possible there is something preventing SSH to operate properly (as in here, when not connected to a VPN)
Using HTTPS, of course, is a workaround:
git remote set-url origin https://git#bitbucket.XXX.com/XXX.com/XXX.git
After discussion, the missing step was to add the private key to the ssh-agent
ssh-add OEDQ_BIT added the private key
Why does this occur? This is a secret gist, and I removed the PII from the block of code below:
user#NT696918742080085 MINGW64 ~/AppData/Roaming/Code/User (master)
$ git push -u origin master
The authenticity of host 'gist.github.com (xxx.xxx.xxx.xxx)' can't be established.
RSA key fingerprint is SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxx.
Are you sure you want to continue connecting (yes/no/[fingerprint])? no
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Check first if your key is properly recognized:
ssh -Tv git#github.com
Then, following "Pushing to gist", double-check your gist SSH URL, or try (with 2FA activated), an HTTPS URL.
I am trying to use alchemy api for entity extraction
https://github.com/AlchemyAPI/alchemyapi_python
When i give this command to clone
git clone https://github.com/AlchemyAPI/alchemyapi_python.git
I get this error:
The requested URL returned error: 403 Forbidden while accessing https://github.com/AlchemyAPI/alchemyapi_python.gi/info/refs
fatal: HTTP request failed
Please let me know what should I do?
You can try and debug it with GIT_CURL_VERBOSE=1 before git clone.
You also can try cloning it with ssh:
git clone git#github.com:AlchemyAPI/alchemyapi_python
(Make sure your public ssh key is registered first and that ssh -Tv git#github.com works)
I just cloned it with the https url without any issue.
Download the code as zip file. There is option on bottom-right corner.
I'm using terminal, I want to delete ssh keys from and old user (old_username) and set a new one (new_username). I have done as is in this tutorial.
When I run: ssh -T git#github.com I get the correct message:
`Hi new_username! You've successfully authenticated'.
But when I try to push a repository I get denied:
remote: Permission to new_username/test2.git denied to old_username.
fatal: unable to access 'https://github.com/new_username/test2/': The requested URL returned error: 403
I've tried deleting .ssh folder and setting again ssh, but the problem persists.
Using an https url means your ssh connection is not used. At all.
Try switching to ssh:
git clone git#github.com:new_username/test2
That will actually use your ssh credentials, meaning your public and private keys stored in ~/.shh/id_rsa(.pub).
If on Linux or OSX, check a file called ~/.netrc, which contains username/password information that most apps will use when connecting to remote servers. Yes, it even affects git via the https protocol. If you're using a frontend to connect to github, you probably need to clear its preferences so it stops trying to use the old username.
I want to add a file into github as follow:
git init
touch test.txt
git add test.tst
git cmmit -m'testtest'
git push origin master
then it will raise this exception:
error: The requested URL returned error: 403 while accessing https://github.com/yacheng1127/YWProject.git/info/refs
fatal: HTTP request failed
then I verify the public key is attached to my github account:
$ ssh -T git#github.com
Hi yacheng1127! You've successfully authenticated, but GitHub does not provide shell access.
$ ssh-add -l
2048 1a:a1:33:26:21:68:7e:9c:26:19:fb:74:a4:d1:6b:bd yacheng1127#gmail.com (RSA)
then I check my remote url:
$ git remote -vorigin
origin https://github.com/yacheng1127/YWProject.git (fetch)
origin https://github.com/yacheng1127/YWProject.git (push)
I don't know where is the problem. could somebody help me? thank you
Use ssh key is used when you use the "git://" url for your remote, you can change this (https://help.github.com/articles/changing-a-remote-s-url).
But "https://" should work too (read/write), but it can't use your ssh key nor ssh agent, you should give git your github login and password :
https://help.github.com/articles/set-up-git#password-caching