I recently created a new gitlab repository, and have set up a repository deployment key with the ssh public key from my computer. I manage to clone the project with ssh, but when I try to push changes into the repository, I get returned with a fatal error:
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
In order to be able to push all the following should be implemented first
Make sure the project has been created under your username on
GitLab.com.
your Git username and email match your GitLab.com account for this
repository
the remote origin was set:
git remote add origin git#gitlab.com:user_name/work.git
an SSH public key was added to your GitLab.com account (if cloning
over using git or ssh).
ssh -T git#gitlab.com
Otherwise you could create a specific access token for the project you want to write to
The following guide could be useful https://blog.programster.org/gitlab-create-a-projects-access-token
Related
i have tried all means to add this remote repository but i cant pull
or push when i push a git-hub repository it works what am i missing
e.gatoto#EMMANUEL MINGW64 ~/Desktop/myrepo.git (master) $ git push
origin master e.gatoto#192.168.180.27's password: fatal:
''~/Desktop/myrepo.git'' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the
repository exists.
e.gatoto#EMMANUEL MINGW64 ~/Desktop/myrepo.git (master)
List item
If you have double authentication on github you will have to create a key when pushing from remote to get access to the repository.
You will then use the key password instead of the password to your github account.
Maybe its related?
2FA give problems when pushing to GitHub
i can't get a point and understand how it works and what is necessary to do.
I have an account by GitLab and successfully generated private and public certificate in order to provide access to it. I done all steps as describes the https://gitlab.com/help/ssh/README#generating-a-new-ssh-key-pair . Now i decided to create a new project and synchronize the state between gitLab project and one i created local by me. Because i have access to machine, which i used to create both certificate, i simply copied the public key from one machine (located in ~/.ssh folder) to current machine i am working in (in ~/.ssh folder). But it doesn't take any effect. I can't even execute the git clone command.
~> git clone git#gitlab.com:[myUser]/[myProject].git
Cloning into 'gate-controller'...
git#gitlab.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 tried to figure out the reason and executed
~> ssh -vT git#gitlab.com
but to be a honest i can't interpret that response. I don't see in response any reference to my public keys file in ssh folder.
Could you please support me to solved the issue and understand, what is the problem ?
many thanks in advance
UPDATE:
You need the private key on any machine you're attempting to pull/push from. When authenticating with a service that has your public key (which any git service like Github, Gitlab, etc. will have) you need to use your private key when authenticating.
You can read more about ssh (which git uses when you don't use HTTPS auth) and PKI (Public Key Infrastructure) here https://www.ssh.com/pki/
I'm running a CI machine on AppCenter and need to allow read/write access to a private BitBucket repository but I can't figure out how to do this.
My approach is to create an ssh key and during CI builds add the private key to the machine ssh-agent using ssh-add -K (mac machine).
I've created an ssh key on my local computer (mac) using ssh-keygen and uploaded the .pub key to BitBucket. Then as my CI runs I'm trying to take the private key and add it to the ssh-agent but I'm being prompt to enter a password and can't figure out how to inject it in a non-interactive shell mode.
Is this the right approach to grant access to BitBucket in CI? if so, how can I add an ssh key without being prompt to enter a password?
Scripts are in Ruby or Bash.
The repo contains certificates used for Fastlane Match
Answering my own question...
I ended up using BitBucket AppPasword and cloning via https. I think there has to be a better way but this work for my needs at the moment.
I needed access from my CI to a private BitBucket certificates repo to use with Fastlane Match, the value in my MatchFile forgit_url that allows me to clone the repo is:
git_url "https://{BITBUCKET_USER}:{BITBUCKET_APP_PASSWORD}#bitbucket.org/{BITBUCKET_USER}/{REPO}.git"
You can obtain a bitbucket app password by clicking your profile (Avatar) -> Settings -> App Passwords
I am having an issue with mercurial. I have ssh keys set up between my machine and the bitbucket account I am cloning with and I am able to clone any repo that I have created. However I am trying to clone a friends repo and she has given me read access, however when I try to clone via ssh I get the following error:
"remote: conq: repository access denied.
abort: no suitable response from remote hg!"
I am able to clone this repo via https and I am totally lost. It seems like an ssh issue but I am lost.
If none of the ssh troubleshooting BitBucket tips works, make sure you are not using sudo when trying to clone (as in "SSH to bitbucket returing Permission Denied (publickey)")
The key is to make sure your $HOME/.ssh/id_rsa(.pub) ssh files are used by the git clone command, and that your public key is in your account (which it should, since you can clone your own repos with ssh).
I've set up my local system for working with GitHub how descrided in the "Generating SSH Keys" How-To.
The key files and the known_hosts have been created, the public key has been added to the GitHub account, and I get the message "Hi ***! You've successfully authenticated, but GitHub does not provide shell access."
But all my attempts to do something, what needs a connection to the server (EDIT: with writing access) -- git clone, git push etc. -- end with an error:
fatal: The remote end hung up unexpectedly
EDIT:
I can clone, but only via HTTP (https://github.com/account/reponame.git) or Git Read-Only (git://github.com/account/reponame.git).
EDIT:
***#**** ~/.ssh
$ ssh-add -l
Could not open a connection to your authentication agent.
Although an ssh-agent daemon (ssh-agent.exe) is running.
Probably that is the problem.
The only instance where that error message pops up, while your public ssh key is correctly recorded by GitHub, is when
you try to clone a repo with a wrong case or an improper ssh url.
It should be:
git clone git#github.com:user/repo.git
you try to clone a repo for which you don't have write access (public repo), or any access (private repo).
From the GitHub page "Which remote URL should I use?"
To use these URLs, you must have write access to a public repo or any access to a private repo.
These URLs will not work with a public repo you do not have write access to.
the private key is passphrase protected and your authentication agent doesn't run properly:
$ ssh-add -l
Could not open a connection to your authentication agent.
For the last case, consider "How to run (git/ssh) authentication agent?" or "ssh-add complains: Could not open a connection to your authentication agent"
It works!
I've started the Pageant (PuTTY SSH authentication agent) and added my PuTTY private key id_rsa.pkk (exported with PuTTYgen (PuTTY Key Generator) from id_rsa) to it. Now I can write to my repos.
A small how-to for everyone, who has the same troubles I had:
0) Set up the local system for working with GitHub, how descrided in the "Generating SSH Keys" How-To.
1) Open PuTTYgen, load/import the (OpenSSH) private key id_rsa and save it (button Save private key) as id_rsa.pkk (in the same folder, where id_rsa is saved, -- ~/.ssh). You need this PuTTY variant of the key for PuTTY authentification with Pageant and (if you use it) TortoiseGit.
2a) Open Pageant (on my computer it's C:\Program Files (x86)\PuTTY\pageant.exe) and add the PuTTY private key. Or just open the PuTTY private key file (id_rsa.pkk) with Pageant.
2b) For TrtoiseGit I had only to set the SSH client (C:\Program Files (x86)\Git\bin\ssh.exe) in the global TrtoiseGit settings.
That's it.
I've got it working, but I don't have a deep understanding of this
thema and cannot provide a low level explanation of the solution and
the causes of this problem (and e.g why it was working in some clients
and wasn't in some others). So feel free to edit/comment this post, if
you can explain all this better.