How to "repo init" on a disconnected system? - repository

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

Related

Cannot clone from gitlab with SSH

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

When i build the Telegram App it shows "SSignalKit/SSignalKit.h file not found"?

I cloned Telegram App but compilation fail with "SSignalKit/SSignalKit.h file not found"
What should i do to fix this?
You need to install the git submodules as well, this can be done with:
git submodule update --init --recursive
After successfully doing the that, build should fail because it cannot find the file config.h,
this can be fixed like described here.
Note: the submodules are linked with their ssh link, so if you don't have an authorized ssh for github on your mac, you either need to create one or change the links to the submodules repos from ssh links to https links (which can be found under [PROJECT_ROOT]/.gitmodules and [PROJECT_ROOT]/.git/config

Git mirror setup with bare upstream repo for Gogs

Given an existing bare repository on a network share, I'd like to be able to use Gogs for issue tracking (etc.) without disrupting the workflow for everyone else who's already using the bare repo.After reading up a bit, I was under the impression that a mirror would provide this functionality, and I would be able to set it up in Gogs through a Migration. When adding a Migration in Gogs by providing the path to the network bare repository and selecting "This repository will be a mirror", however, I get the following error:
Migration failed: check bare: exit status 128 - fatal: bad object HEAD
Looking at the log, I can see the following:
2016/06/13 13:19:20 [T] action.newRepoAction: myuser/the-repo-name
[git-module] git clone --mirror --quiet X:\path\to\bare\repo.git X:\path\to\gogs\repo.git
2016/06/13 13:19:30 [W] Delete repository wiki [X:\path\to\gogs\the-repo-name.wiki.git]: exit status 2
Strangely enough, I can issue git clone --mirror through git bash and have it execute successfully.
$ git clone --mirror /X/path/to/repo.git my-mirror.git
Cloning into bare repository 'my-mirror.git'...
done.
My questions are the following:
Is this set up possible? That is, can I commit to the Gogs mirror and have my commits pushed upstream to the bare repo, and viceversa (commits from other users to the bare being synchronized with my Gogs mirror)?
If so, how can I get this to work on Gogs?
Many thanks in advance!
PS: I also get the error above when attempting the Migration on a brand new bare repo, so I wouldn't think the issue lies in the bare repo itself.
After trying this again on the last release of gogs (v0.9.13), the issue seems to have been fixed.

Git directly commit file to git and/or gitlab

So, here's my use case:
I'm attempting to develop an internal Mac app for the non-developers on my team, to edit some of my game's parameters. Ideally, the application will be able to recreate the necessary config files and directly commit/push them to my gitlab instance, which would trigger a CI build.
I know I could programmatically clone my repo to their machine and then edit it programmatically and commit the changes, but I'm trying to avoid having to have each user who is only editing a few files cloning 2+GB of code.
Any suggestions how to commit directly to a remote repo? In this case, both the user and my server can be considered "trusted". Thanks!
That would look like those config file could be in their own (very small) git repository, and kept in the main repo as a submodule.
However, once a submodule has been pushed back, a hook should make sure the parent repo update its submodule reference (git submodule update), and add+commit the new SHA1 of said submodule which was just pushed.
Otherwise, the parent repo wouldn't realize that its submodule has changed.
That also means the parent repo should declare that submodule as following the latest SHA1 of master branch:
git submodule add -b master /url/to/submodule
For something as restricted as this a single-repo solution would also work:
Make a configs-only branch:
git checkout --orphan configs
rm all but configs
git add -A
git commit -mconfigs
git checkout main
git push server configs
In the config-editor repos:
git init configrepo
git remote add server u://r/l
git fetch server configs
git checkout -t server/configs
# work work, then
git commit -am "new configs"
git push
As part of your build,
git pull -Xtheirs configs

How to config SSH for gitlab?

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