I have a cloud9 repository on AWS and I would like to clone a github repository into it. I have followed the documentation instructions of copying the http link on github and running this command:
git clone git#github.com:[my repo]
I get this error message when running the command:
Cloning into 'pm-tool'...
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Does the user name on git have to match the user name on the AWS environment? Any suggestions for troubleshooting this problem?
You shouldn’t upload your GitHub login to anywhere as a general rule.
You need to grab/create a key from AWS, then save in your GitHub repo as a deploy key.
Get your Cloud9 key.
Add it to GitHub here: https://github.com/[user/org]/[repo_name]/settings/keys.
See: https://community.c9.io/t/public-ssh-key-needed/1315/3
Related
I try to clone a private organization github repo onto a server instance, running debian. I try to avoid putting in my private SSH keys, because if they would get leaked, someone would have access to all of my repositories.
Hence I found the way of using deploy keys for private github repos. The way I imagine them to work is the following
create ssh keys on your server
add private key to github repo (under "deploy keys" area)
add config file in ~/.ssh folder on your server
you can git clone the github repository.
Unfortunately, with this setup I am receiving an error that I do not have the correct permissions set.
My config file:
Host github
Hostname github.com
User git
IdentityFile ~/.ssh/MY-REPONAME-gh
When trying to clone via SSH: git clone git#github.com:ORGNAME/MY-REPONAME.git
I receive this error:
Cloning into 'MY-REPONAME'...
git#github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I have a git folder. The remote points to https://myusername#github.com/repo.git. I have cloned this repo from a publicly available repo. When I do git push it asks me for https://myusername#github.com.
I havent used git in a while. I realized they don't do password anymore. So I generated a token and used it in the place of the password. However I am getting the following error
remote: Permission to repo.git denied to myusername.
fatal: unable to access 'https://github.com/repo.git/': The requested URL returned error: 403
However my impression was that I was accessing the repo at myusername#github.com not trying to modify the original public repository "repo.git"
What am I missing? My remote seems to be pointed to my account and it asks the password to my account. Sorry I am inexperienced with git and seem to be missing something fundamental
Thanks
I followed the official explanation on Github on how to register my SSH key, and according to their documentation, everything should work:
$ ssh -T git#github.com
Hi username! You've successfully authenticated, but GitHub does not
provide shell access.
Unfortunately, this does not tell how to clone / push / pull repositories, and there is not documentation on that anywhere.
For example, having freshly created a new (private) repository, I have copied the repository address and tried:
git clone https://github.com/myusername/mynewrepository.git
I merely received
Cloning into 'mynewrepository'...
Username for 'https://github.com': myusername
Password for 'https://myusername#github.com':
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: Authentication failed for 'https://github.com/myusername/mynewrepository.git/'
Question: What are the exact commands to perform Git operations on a (private) repository on Github?
If you want to use your SSH key for git operations, use:
git clone git#github.com:myusername/mynewrepository.git
...as explained in the documentation. The SSH key does not affect any HTTPS based connection
Use git clone git#github.com:myusername/mynewrepository.git to clone via ssh
I initialized a repo in my GitHub. I issued a git clone command. I went to the directory in my local computer where I wanted to clone the repo. Then I copied some files in my local drive. Then I did:
git add .
git commit
git push -u origin master
The message appeared:
remote: Permission to jasonkid1/testuli.git denied to jpamittan.
fatal: unable to access
'https://jasonkid1#github.com/jasonkid1/testuli.git/': The requested
URL returned error: 403
How can I fix this?
For any https authentication issue, you need to check your credential caching:
git config credential.helper
That is:
On Windows, for instance, you would need to open the Windows Credential Manager and check the right password was entered.
On Mac, you would need to update the OSX keychain.
You might have credentials for any github.com URL associated to jpamittan (wrong user) instead of jasonkid1.
I am connecting to github through my ftp server. I added the public key generated by my server then tried to connect and it is still giving me "permission denied", I attached a screenshot below.
You cannot just ssh into githubs servers in this way. Github's SSH server allows you to use git through their servers, not shell access. You get "permission denied" because you login with user github instead of git.
After adding your SSH public key to Github (which you've done correctly), just use git with the SSH remote.
If you have not a local repo yet, just use something like:
git clone git#github.com:Bumblebee-Project/Bumblebee.git
Otherwise, add a new remote to your existing git repo:
git add origin git#github.com:Bumblebee-Project/Bumblebee.git
After that, push your local repo with:
git push
See also http://help.github.com/remotes/