Git mirror setup with bare upstream repo for Gogs - 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.

Related

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 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 "repo init" on a disconnected system?

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

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

How to update 'git log' after 'git svn fetch' on a bare repo?

I have a bare git-svn repository and did a 'git svn fetch' on it.
Running 'git log' doesn't show the updates. I'm sure there are updates as it displayed the files changed after 'git svn fetch' and 'git svn log' shows them also.
Please note that I purposely made this a bare repo so 'git rebase' will not work.
What is the appropriate command to get the fetched changes?
A git svn fetch adds a new remote branch called remotes/git-svn (as can be seen with git branch -a).
If you make changes to the upstream svn, then run git fetch again, the changes get pulled (actually, fetched) in on this branch, not on master.
So to make git log (and everything else) work ok on the master branch you just need a merge, as you normally would have to do after a fetch (this is what git pull does, a fetch and then a merge).
Since git svn pull does not work, you will have to merge it manually. While on the master branch, run:
git merge remotes/git-svn
This will merge your master branch with the git-svn branch, making everything ok again.
So in the future, run
git svn fetch
git merge remotes/git-svn
and you will be up to date with the upstream repository once again.
Setting the ref of master's head to git-svn head as suggested by vjangus will also make this work, but you shouldn't ever be making changes in a remote branch.
Try git log git-svn - I don't have a bare repo, but I've just run git svn fetch, and standard git log gives me the current (rebased) log, but with the git-svn arg (which is the other branch besides master that is identified by git branch -a in my case) I get the log up to the fetched revision
I found the answer,
git symbolic-ref refs/heads/master refs/remotes/git-svn
Thanks to Steven Walter's comments in
http://gsocblog.jsharpe.net/archives/12