Unable to complete svn2git in a shell script - linux

I am migrating a SVN codebase to Git and need to create more than 30 projects. Hence I approached this problem by automating the steps in a shell script.
Below is the code snippet
test.sh
#!/bin/sh
svn2git http(s)://svn.yyy.xxx.com:1080/SVNROOT/PROJECTSUITE --trunk trunk/SOURCES/Project1 --notags --nobranches --authors /Users/praveen/users.txt --verbose > log.txt
git remote add origin git#gitlab.yyy.xxx.com:PROJECTSUITE/Project1.git
git push origin --all
I am able to perform this migration successfully when the commands are executed individually from the terminal.
Terminal
$ svn2git http(s)://svn.yyy.xxx.com:1080/SVNROOT/MERLINSUITE --username praveen --trunk trunk/SERVER_SOURCES/MerlinTMS --notags --nobranches --authors /Users/praveen/users.txt --verbose
Running command: git svn init --prefix=svn/ --no-metadata --trunk=trunk/SOURCES/Project1 http(s)://svn.yyy.xxx.com:1080/SVNROOT/PROJECTSUITE
Initialized empty Git repository in /Users/praveen/projectFolder/.git/
Running command: git config --local --get user.name
Running command: git config --local svn.authorsfile /Users/praveen/users.txt
Running command: git svn fetch
W: Ignoring error from SVN, path probably does not exist: (160013): Filesystem has no item: File not found: revision 100, path '/trunk/SOURCES/Project1'
W: Do not be alarmed at the above message git-svn is just searching aggressively for old history.
This may take a while on large repositories
....
....
success :)
But when the above shell script is executed using verbose it gets stuck. The project tested was around 30MB in size.
log.txt
Running command: git svn init --prefix=svn/ --no-metadata --trunk=trunk/SOURCES/Project1 http(s)://svn.yyy.xxx.com:1080/SVNROOT/PROJECTSUITE
What am I doing wrong? Is it that svn2git cannot be called within a shell script?

Related

How to manage files of link source by git?

Want
I wanna manage nvim config by git.
Problem
Link is break by git checkout . command. Expect behavior is overwrite my nvim config with remote repository source. But actual behavior is overwrite link with remote repository source.
Code
I was tried as bellow code.
# clone
cd ~/Documents/GitHub/
git clone https://github.com/ShortArrow/my-nvim-config
cd my-nvim-config
# delete "./nvim" for making link
rm -r ./nvim
# making link
ln -s ~/.config/nvim/ ./nvim
# if you need, "cp ~/.config/nvim/ ~/.config/nvim-backup"
# I wanna rewrite nvim config by git with this command
git checkout .
Already Tried
try1
sudo git config --system --unset core.symlinks
git config --local core.symlinks false
try2
$> sudo ln -d ~/.config/nvim/ ./nvim
ln: failed to create hard link './nvim' => '/home/who/.config/nvim/': Operation not permitted
On Windows
This github repository is working good with Junction link on Windows.
A softlink is just a file with the target path in it (and a permission flag telling the OS to treat it as a link), and Git is treating it as such.
Instead of changing what is in the repository by changing the repository file into a link to the config file, link the other way: make the config file link into the repository.

how can I connect to gitlab project of groups from shell

I want to pull a commit from a gitlab project of group (notice: I am a member of the group) I don't know how to connect to the repository from my gitlab a count. I install the git in my ubuntu, configure then add the ssh pb key to gitlab. I spend hours to know how to pull a commit but I don't get the idea. any help ...
Copy the clone ssh link by clicking on the blue “clone” button in Gitlab:
Make sure to copy the link under the label of “Clone with SSH”.
In a bash terminal you would execute the following based on what you copied:
git clone <your-gitlab-user-name>#gitlab.com:name-of-group/project-name
Next you would checkout the branch/commit that you are interested in:
cd project-name
git fetch origin
git checkout <branch-name>
Depending on your ssh setup on your Ubuntu machine, you may need to add your private key to your ssh-agent before running the git clone command.
In case you run into issues related to this, try the following commands:
eval $(ssh-agent -s)
ssh-add /path/to/private/key # Normally in ~/.ssh/ dir
git clone <your-gitlab-user-name>#gitlab.com:name-of-group/project-name

can git be run with less file permissions than the files it tracks?

here is the situation: i want to use git to track a directory of preference files that are owned by root.
it would be nice if git commands that don't modify the files (like git status and git diff) can be run as the user (without sudo).
through the following steps, i've created a repo that seems to function in a reasonable manner:
sudo mkdir .git
sudo chmod <user>:<group> .git
git init
git add .
git commit -m "initial commit"
i can run git status and git diff as the user. git checkout ... and git reset ... fail as the user, but seem to run fine when prefixed with sudo.
this seems perfect: no sudo needed to get into the repo and take a look at what's gone on, but to change the tracked files requires an extra level of effort, as it should for system files.
the question is: will this cause me any problems with how git is reading and writing files inside the .git directory? will any commands i need sudo to run end up creating things inside .git with root permission that will then cause problems trying to run commands that don't modify the tracked files as the user?
thanks and advance for any answers.

Unable to rebase git svn repo through cron job

I tried to update git svn repo (git svn rebase) with cron job, but I get this error.
usage: git-cat-file [-t|-s|-e|-p|<type>] <sha1>
error closing pipe: Broken pipe at /usr/local/libexec/git-core//git-svn line 4290
cat-file --batch: command returned error: 129
I've added git path in cron script, seems not helping.
export PATH=$PATH:/usr/local/libexec/git-core/
git svn rebase is working properly when I login with bash. What else should I do to make it run as cron job?
Seems it is still a PATH problem. After I copied exact PATH from bash env, problem solved.
export PATH=$HOME/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/libexec/git-core/

git autodeploy script within post-receive hook on ubuntu

I have an autodeploy bash script to get updated repo to /tmp in 'post-receive' hook on gitosis
#!/bin/bash
PWD=$PWD
REPO_NAME=${PWD##/*/}
cd /tmp
git clone git#atom-desktop:$REPO_NAME
But anytime when I push repository I got error like this:
Host key verification failed.
fatal: The remote end hung up unexpectedly
error: hooks/post-receive exited with error code 128
How to cope with that ?
You can simply do:
git clone --local $REPO_NAME
As git also supports cloning from local directories:
git-clone
For local respositories, also
supported by git natively, the
following syntaxes may be used:
/path/to/repo.git/
file:///path/to/repo.git/
These two syntaxes are mostly
equivalent, except the former implies
--local option.
Sounds like there is a key mismatch in the SSH connection from wherever /tmp is and atom-desktop. What happens if you try to SSH from the machine that /tmp is located at to atom-desktop?

Resources