I recently installed gitlab on an ubuntu 18.04 LTS instance. I am trying to clone a repo from GitLab.
My ssh config file is as below :
# ~/.ssh/config
User git
Hostname gitlab.com
IdentityFile ~/.ssh/id_ed25519
TCPKeepAlive yes
IdentitiesOnly yes
I have added the ed25519 public key to SSH keys in GitLab. When I try to clone the repo i get this issue-
$ git clone git#xxxx:root/test-project.git
Cloning into 'test-project'...
kex_exchange_identification: read: Connection reset by peer
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
What am I doing wrong? I have checked out a couple of links on the internet but I cant figure out what I have done wrong.
I am able to clone and push if I use http instead of ssh.
git clone http://xxxx/root/test-project.git
Cloning into 'test-project'...
warning: You appear to have cloned an empty repository.
Why does http work and not ssh?
You have your ssh clone statement wrong: git clone username git#example.com:root/test.git
That statement would try to clone a repository named username into the location relative to your current path, git#example.com:root/test.git.
You want to leave out username:
git clone git#example.com:root/test.git
One alternative is Using sourcetree it will hit all the git clone and update command for you in just a click and also gives you a rich graphical representation on your repo and branches
Related
I have created a new repository in gitlab with one readme file created init (through gitlab web portal) and i have added the user to the git repository for accessing (push/merge). Now the gitlab server is an ubuntu machine and i am trying to clone the repo from a different pc(win10) git bash terminal. where i have already configured user settings.
added git user name ,email id , git remote url
generated ssh key in win 10 client and updated the same in gitlab account settings (web interface -add ssh key)
$ git clone ravi#1xx.1xx.2xx.29:8181/ravi/test-project.git
Cloning into 'test-project'...
ravi#1xx.1xx.2xx.29's password:
fatal: '8181/ravi/test-project.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.
can you please help me in resolving this issue
I just downloaded git extensions. It is configured to use putty that comes with the installation. I used putty to create a private and public key and I have the agent started and I have added the private key.
I am using bitbucket and I have loaded my public key to my bitbucket account.
I get the ssh clone link from bitbucket and go to clone it in git extensions, I load the SSH key and hit clone and I get this error message.
Error Message
I have an SSH key loaded. Why is it saying I need to load a key? I uninstalled gitextensions and generated different keys. I looked at all the settings, i'm not sure what i'm doing wrong.
Git Extensions SSH settings
Windows 10
Putty 0.70
Git extensions 2.51.01
bitbucket.org
I found the answer.
When you copy past the git command from bitbucket, it is the wrong syntax for git Extensions.
You will copy something like this:
git clone git#bitbucket.org:guitardenver/led-pad-pcb.git
But you need to remove the "git clone" part for it to work with git Extensions.
git#bitbucket.org:guitardenver/led-pad-pcb.git
I have mirrored a repository with
repo init -u <uri of manifest> --mirror
repo sync
and copied it (by usb) to a system disconnected from the internet along with the repo script and the repo clone bundle repository from https://gerrit.googlesource.com/git-repo/clone.bundle.
I now want to create new client from the mirror, but when I run the command.
repo init -u <uri of manifest on mirror>
i get the following error.
fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle
fatal: error [Errno -2] Name or service not known
So I have the clone.bundle but have no way to persuade repo to use it.
Any suggestions?
There is an option, that appears to be totaly undocumented on the internet for repo. It is --repo-url which allows you to overide where repo looks for the latest version of itself.
This is what I did:
I had the bundle saved in my home as git-repo-clone.bundle
repo init -u < uri of manifest on mirror > --repo-url ~/git-repo-clone.bundle
I found this out by reading the repo script itself, and thought I would share.
There is an option to ignore the clone bundle.
repo init -u <your-manifest-mirror-url> --no-clone-bundle
In my experience of Github, I tought that I need to clone a repository with my user like user#gitlabhost.com. But when I try this, then it does not recognize my password from gitlab. Only cloning with gitlab user does work.
Can anybody please help me??? - How do I have to configure gitlab access right?
If you followed Installation Instructions of gitlab, then you must have installed it on an linux box under the user named git. Typically in a folder like this
/home/git/gitlab
Hence you should use git#gitlabhost.com
I am not sure what you mean by "configuring SSH". But since each user is expected to use her own keypair, there should be no problem in accessing gitlab managed repo's using normal git commands. Both the following should work
git clone ssh://git#gitlabhost.com/group/repo.git
git clone git#gitlabhost.com:group/repo.git
Each user must have set their own git identity (on their local machines) using
git config --global user.name "elitmus"
git config --global user.email "abc#gmail.com"
so that git can uniquely identify each user.
In my experience, I had to connect to the gitlab server, as the git user, and modify the authenticated_keys file, as it was filled with a bunch of random #'s. after clearing that, I added my SSH key in the GitLab GUI and was able to clone and push normally.
Hope that helps.
https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
Generating a new SSH key and adding it to GitLab or github or any ssh-agent
for more information
https://help.github.com/en/github/authenticating-to-github/about-ssh
My Setup:
EC2 Instance with Ubuntu
Apache2 installed (publishes /var/www folder)
Git installed
SSH Keys Set:
$ ssh -T git#github.com
Hi User! You've successfully authenticated, but GitHub does not provide shell access.
My intention:
I want to pull a specific repository on github and publish it onto apache (basically puting the files into /var/www)
Where I am stuck:
Permissions of /var/www are set to root
trying to use sudo for cloning the repo results in a denied permission (root user uses different ssh keys?)
Where to clone my repo to? What diretory is appropriate for that?
How to copy the files then to /var/www?
I am quite new to Linux, so please help me :-) Thank you
I used root's ssh key and that works!
Just created new keys by using the sudo command and used them with github.