Version control

Jenkins

Trigger Jenkins multibranch pipeline with curl or webhook

0

Git branch source

Jenkins jobs that use the widely used git plugin, can be triggered remotely with curl or a webhook. The job must have the option “Poll SCM” enabled. That’s all to enable push triggers, no timer has to be configured. Jobs are only executed if there is an actual source code change. Off course you can configure a timer, if you also want a periodic pull.

An example curl commando to trigger all jobs that have configured the repository URL “ssh://git@bitbucket.mycompany.example/demo/my-api.git” in Git SCM and have “Poll SCM” enabled:

curl 'http://jenkins.mycompany.example/git/notifyCommit?url=ssh://git@bitbucket.mycompany.example/demo/my-api.git' --user 'jenkins-trigger:mysecrettoken123'

More >

Git delete local and remote branch

1

First checkout a different branch than the one you want to delete, for example the master branch.

git checkout origin master

Solution 1

To delete your local and remote branch execute the following. “-r” stands for remote and “-d” for delete.

git branch -rd example

Solution 2

First delete the local branch:

git branch -d example

And after that also the remote branch:

git push origin :example

Git how to create remote branch from checked out master

0

In a project you’ll reach at a certain point the need to start working on a new major version of your application, lets say version 2. Then you’ll probably want the current master to move to a branch with a name like “1.x” and from then on the master branch will contain version “2.x”.

To accomplish this, you’ll have to do some simple steps. I assume you already have a Git clone on your computer, go to the root directory of your clone and make sure you are in the master branch.

git branch -a

The branch with More >

Create Git bare / shared remote repository

1

This blog post will describe how to setup a central repository where everybody pulls from and pushes to. This is actually the default work flow in Subversion.

Create a “git” user on your server.

sudo adduser git
nano /etc/group
git:x:1000:myusername,www-data,nobody
sudo mkdir /opt/git_projects
sudo chown git.git /opt/git_projects
sudo chmod 2770 /opt/git_projects
cd /opt/git_projects

Git has a naming convention that repositories that you share with others have a “.git” suffix. Local repositories have just a name. To create a git bare (also called shared remote) repository do the following on the command line.

su git
mkdir example.git
chmod

More >

Convert SVN to GIT bare repository

0

When trying to convert a SVN repository that contained all our projects, I couldn’t find a good solution on the internet on one page.

The most usefull pages were:

https://github.com/nirvdrum/svn2git

http://qugstart.com/blog/git-and-svn/migrate-an-svn-repository-to-git-while-maintaining-branches-and-tags-structure/

http://book.git-scm.com/4_tracking_branches.html

I combined them together and described the steps below that will get the job done.

sudo adduser git
nano /etc/group
git:x:100:usera,userb,userc
sudo mkdir /usr/local/git_root
sudo chown git.git /usr/local/git_root
sudo chmod 2770 /usr/local/git_root

Create authors.txt file for user mapping:

root = Root <root@example.local>
usera = My name <myname@example.local>

To get a listing of all users in the repository:

svn log file:///development/svn_projects | grep -E

More >

Go to Top