we are migrating from Gerrit Code Review to GitLab in our office. I know how to clone one repository from Gerrit to GitLab. But in our office server we have around 50 or so repositories. I have tried transferring the repositories manually to GitLab's 'repositories' directory and then importing, but it only creates bare repositories. I'd like to know if there's a way to clone all the repositories in one go. Please help...
but it only creates bare repositories
That is what GitLab manages, as a Git Hosting service: bare repos that you can clone locally.
You could move those non-bare repo by:
moving only the .git of your existing repo to GitLab repo folder, where each .git is renamed after the repo it was in:
repo1/.git => /home/git/repositories/repo1.git
repo2/.git => /home/git/repositories/repo2.git
repo2/.git => /home/git/repositories/repo3.git
If you are talking about two different servers (hopefully both with the same OS), I would recommend tar cpvf repo1.git.tar /tmp/repo1.git: move in /tmp and rename first, then tar, and copy over that tar to the new server.
transform those repos into bare one:
cd /tmp/repo1.git && git config --bool core.bare true
Try the Import process of GitLab (but there seems to be a bug in progress on that: issue/pull 5005
bundle exec rake gitlab:import:repos RAILS_ENV=production
While the import process command is correct, the OP redmoses mentions in the comments:
If I just copy the repositories to /home/git/repositories, then the repositories appear in GitLab with no source files or no record of previous commits done in Gerrit.
To make this work this is what I did:
Created a new directory inside the repositories directory
Copied all the repos from Gerrit (was located in /usr/local/gerrit2/git) to the new directory.
Then just simply ran GitLab's import process GitLab then created a group called "Dev" and imported the existing repositories perfectly.
And I didn't need to convert the repositories to bare.
Related
I tried uploading my files to Github, but GitHub says it's too big.
I then uploaded the content of the dist folder after building for production.
This worked just fine, but it's not very useful.
What is the proper way to upload a Vue.js app to GitHub?
What you generate (binary files which can be big) should not be versioned/pushed to GitHub.
It is better to use a local plugin which will, on GitHub side, build, tag and publish a release associated to your project.
For instance: semantic-release/github.
You can combine that with a GitHub Action, which can take that release, and deploy it on a remote server of your choice (provided it is publicly accessible from GitHub): see for example "How to deploy your VueJS using Github Actions (on Firebase Hosting)" from John Kilonzi.
For your existing dist, you should delete it (from Git only, not your disk) and add it to your .gitignore:
cd /path/to/repo
git rm --cached dist
echo dist/>>.gitignore
git add .gitignore
git commit -m "Delete and ignore dist/"
git push
What happens if I add a node module( like if I decide to add an image cropper). How can the other contributers deal with that?
You need to add the declaration of that module in your project, not version the module itself. For instance, using Vue.use.
Also: I host the app on netlify. It builds the site straight from github. But it wont be able to build the site if gihub doesnt have the dist folder...
See "How to deploy your Vue app with Netlify in less than 2 min!" from Jean-Philippe Fong: Netlify itself will build the dist (from your GitHub project sources) and publish it.
You should add a .gitignore file to the root of your directory where you can ignore files and directories.
Most typical ones to ignore are the following:
node_modules
/dist
.env
.vscode
I've switched to windows and am having a hard time using bitbucket with it.
Within the downloads menu you can add files but this is not added to source.
I've also tried using source tree (web application) but when I attempt to push the files they do not exist in my directory. Any idea how I can do this or a guide which explains how to upload files. It's been a number of years since I have used bitbucket on windows.
Bitbucket is simply a git provider. You'll have to use Git commands (or a GUI like Sourcetree, Gitkraken, etc.) to push (upload) your files to source.
A basic guide to working with Git can be found here.
Windows or Linux only you need a git console or git cli installed in your default cli.
First clone your repository to your local system. Go to your
bitbucket account and your repository need to be file uploaded. Copy
the git url command. Open git console and type the following command.
git clone "git URL"
Explore you repository and make changes. Like add file which you want to upload to it.
Go to your git console again and type the following commands.
git add .
git commit -m "commit message like - adding file"
git push origin master
I have a repository directory under .m2 that I want to use as a remote repository (-Dmaven.repo.remote=http://remotehostname/repo) to other hosts. I tried just to expose the directory .m2/repository/ under Apache as http://remotehostname/repo, the directory is fully visible via HTTP, but Maven doesn't seem to be reading from the exposed repo. For various reasons, I do not want to add this new remote repo to settings.xml; limit it to -Dmaven.repo.remote
What do I need to do to convert a local repo under .m2 as a remote repo?
Further to #Perception's answer, you can look at Nexus Command Line tool, which can help convert your local repo to nexus repo
I haven't heard of any maven repository manager that can simply mirror your .m2 folder (which is just a local repository). You need to install and configure repository management software ... there are many free, open source ones, I recommend Artifactory or Nexus.
Nexus does fit very closely with your requirements since it uses a file based repository, and the file layout matches with the local repo layout.
We've got a "bare" git repository on a server, for a Web portal project. Several programmers, designers, etc... perform dozens of push and pull from/to it.
Now we want to test the project on the server itself, and always test the last commit through an Apache web server which is installed on the same machine the "bare" git repository is stored in.
How can we 'unbare' the repository, and let the working directory contain always and only the last commit deriving from the last push?
Or anything else aiming to achieve the same result?
You can use a post-receive hook to do a git pull inside your webserver document root/repository.
in your bare repository
do
mv hooks/post-receive.sample hooks/post-receive
chmod +x .git/hooks/post-receive
the post receive should be something like
#!/bin/sh
WEB_ROOT='/var/www/project'
cd $WEB_ROOT
git pull
A more elegant solution that doesn't involve that the web server area being a git repository, you can also review the git documentation about hooks
Note: if you use the simple solution, please make sure that your webserver doesn't serve the .git directory, this would give some hackers/crackers the access to the website source code!
I am working on a gui based helper utility that will:
Init a local repo, Init (bare) a remote repo
Add .gitignore based on a project type
Commit all the files locally
Add a remote repo to the local config
Push master to the remote repo
Create a develop branch and push it to master
All this is done without git installed by using ngit (.NET port of jgit).
But I can't figure out how to setup tracking to track master to origin/master and develop to origin/develop using just ngit.
I can do it easily with
git branch --set-upstream master origin/master
However, I was hoping to avoid the dependency of a local git install.
Here is a Java snippet that corresponds to the --set-upstream option to git branch:
Git git = Git.open(new File("/home/repos/myrepo"));
CreateBranchCommand create = git.branchCreate();
create.setUpstreamMode(SetupUpstreamMode.SET_UPSTREAM);
create.setName("develop");
create.setStartPoint("origin/develop");
create.call();