Gitolite, can't clone new repo - clone

I've just installed gitolite on my Debian server.
Then I cloned gitolite-admin repo and and new public key + following lines to conf file:
repo wallr_common
RW+ = wall
New repo was created after push.
At first I go to authorized_keys and saw that key for new user not exists, then I run ~/.gitolite/keydir$ gl-setup, and the key appears in authorized_keys.
Now I'm trying to clone it but I'm getting error:
git.exe clone --progress -v "ssh://wall#192.168.1.110:/wallr_common.git" "D:\wallr_common"
Cloning into 'D:\wallr_common'...
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
git did not exit cleanly (exit code 128) (5834 ms # 04.07.2013 0:27:46)
What can be the root cause of this?

You must use the git or gitolite account for your ssh session. Not the user account wall that you registered in gitolite.
That means ssh://git#..., instead of ssh://wall#....
Replace 'git' with the account you used to install gitolite.
See more at "How do programs like gitolite work?".
This is a similar mistake as in this question.

Related

Can't clone bitbucket repo locally

I set up my SSH key for my account.
When I run git clone in my terminal I usually get Forbidden fatal: could not read from remote repository.
Running ssh-add -l shows the correct authenticated agent.
Running git clone is now asking for my passphrase with the above error message.
Saying "please make sure you have the correct access rights and the repository exists."
I ran ps to make sure there was only one authenticated agent
The clone command is git clone git#bitbucket.org:<filepath>.git
The URL should:
not be git#bitbucket.org:<filepath>.git
but git#bitbucket.org:<account>/<projectname>.git
you can use:
export GIT_SSH_COMMAND='ssh -Tv'
You will see which key SSH is using.
Make sure the public key has been registered to your Bitbucket account settings.
But the OP adds:
It's private and I'm not the owner. Does something need to be updated with access settings by the owner?
Then yes, your account needs to be granted access in that repository by its owner.

composer install does not use ssh key on private repo (permission denied public key)

I have a Laravel project with some dependencies to private packages, secured through ssh, working on windows 10 with Laragon.
On composer install I get a permission denied (public key), however, if I clone the repo directly I get my regular prompt to type the ssh-key password for authentication and the clone works with no problems (using git#gitlab...., so no https).
The output looks like this:
Failed to execute git clone ...
Cloning into 'project/path/foo/bar'...
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 already added the host (a private GitLab server) to my git config file, including the path to my ssh key, which seems to work due to git clone succeeding.
I expected that composer install would prompt for the password, but it just stops.
Any ideas how to solve this problem? I normally work on Ubuntu and didn't have such a problem before.
Edit:
Tried out the same commands with git bash (Git for windows) and it worked. But if I use Powershell or ConEmu(through Laragon) it won't work, any ideas?

cloning private repo using ruby-git

I'm using ruby-git to programmatically perform some operations git repos hosted on GitHub.
Everything works fine when I do it on public repos however, I'm not able to clone private repos even if I have created an ssh key on the machine when the code runs and added the public one on GitHub. To make sure the key is properly setup I have cloned the repo directly from the terminal and the repo was successfully cloned. The key has also been added to the ssh-agent and $SSH_AUTH_SOCK is set.
So, I think the issue is related to how I use the ruby-git gem.
Here my (simple) code
#repo = Git.clone("git#github.com:#{repo_full_name}.git", path)
And here, if it may be helpful teh error
Git::GitExecuteError: git clone '--' 'git#github.com:USER/REPO.git' '/var/www/repo-root/USER/REPO' 2>&1:Cloning into '/var/www/repo-root/USER/REPO'... Permission denied (publickey). fatal: Could not read
Am I missing anything here?
Thanks
Do you have your Git env config pointing at your ssh key path?
Git.configure do |config|
# If you want to use a custom git binary
config.binary_path = '/git/bin/path'
# If you need to use a custom SSH script
config.git_ssh = '/path/to/ssh/script'
end

Git remote add origin: correct URL and path to add remote repo on the local network

I am trying to set up a remote repository on a Mac on my local network. I have done the following:
Set the sharing privileges on the remote, allowing access to all users (using System Preferences/Sharing)
confirmed that I can SSH to the remote machine
created the repo in the remote directory
created a repo in the local machine directory
executed this command from the local repo directory:
git remote add origin FSM13#192.168.1.51:/Library/FileMaker\ Server/HTTPServer/htdocs/fm-php
when I attempt to push:
git push -u remote origin master
I get these errors:
fatal: 'remote' does not appear to be a git repository
fatal: Could not read from remote repository.
I get the same error using this syntax to set the remote
git remote add origin ssh://FSM13#192.168.1.51/Library/FileMaker\ Server/HTTPServer/htdocs/fm-php
FMS13 is the administrator user account on the remote machine.
What steps might I be missing?
There were three things I needed to do in order to solve this issue:
set up the SSH Keys correctly
initialize the remote repo correctly (using --bare) (this worked but I need to try a few more things. a bare repo does not have any files, just the history: http://www.saintsjd.com/2011/01/what-is-a-bare-git-repository/ )
set the path correctly for the git remote add command
Note that I am using OS X.
This youtube vid and blog post laid it out perfectly:
https://www.youtube.com/watch?v=DDzeiI2yZL8
http://crosbymichael.com/setup-password-less-login-over-ssh.html
SSH Keys:
On the local machine, starting from home directory:
cd .ssh
cat id_rsa.pub
then copy the printed public key. I happened to already have one. The blog post above explains how to create one.
SSH into the remote:
ssh FMS13#192.168.1.51
ls -a
Is there a .ssh directory? If not create one. It needs to be in the home directory.
mkdir .ssh
cd .ssh
then create a keys file
touch authorized_keys
nano authorized_keys
Then paste the key and save the file.
Confirm the install of the key by ssh'ing from the local machine:
ssh FMS13#192.168.1.51
No password was requested, so the key install was successful
Correct repo initialization:
On the remote machine, cd to the desired parent directory and:
mkdir remote-git
cd remote-git
git init --bare
On the local machine from the repo directory, the correct path was as follows to set the remote origin:
git remote add origin ssh://FMS13#192.168.1.51/Users/FMS13/Desktop/remote-git
Where FMS13 is the user on the remote computer, followed by the ip address and then the full path to the directory of the remote repo.
Push to remote:
Then back in the local machine, cd to the repo directory and:
git push origin --all
I have used something similar to this command recently which worked for me:
git remote set-url origin ssh://FSM13#192.168.1.51/USERNAME/REPOSITORY.git
Check out this link for more information. For your case, you may need to be adding the following instead. I have not seen using an IP address with this, though- so refer to the link.
ssh://git#192.168.1.51/USERNAME/REPOSITORY.git
You may also need to generate a new ssh key. Here is a link on that:
ssh-keygen -t rsa -C "your_email#example.com"

MSysGit Not finding Repo

So I had a repo working by adding it to the htdocs in apache, however, I couldn't commit. So I set up SSH (I am using copSSH) and I can ssh into the server and see the files in my project.git. However I get the following when I try to clone...
$ git clone un#server:/home/un/Repositories/git/test.git/
Cloning into 'test'...
un#server's password:
fatal: '/home/un/Repositories/git/test.git/' does not appear to be a git re
pository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Any ideas?
Oops this did work...
git clone un#server:Repositories/git/test.git/
Must be an environment var issue

Resources