I created a new repository XYZ in GitLab. I integrated that repository XYZ to TeamCity. I wanted to write a build step that copies contents of the XYZ to TeamCity server when ever a change is pushed to that repository. Can some please suggest me how to do that?
I integrated the new repository XYZ and triggered the job (without any build steps) and it is able to collect the changes from correct repository and correct branch.
Collecting changes in 1 VCS root
[11:04:40][Collecting changes in 1 VCS root] Compute revision for 'hippo gitlab replacement'
[11:04:40][Compute revision for 'hippo gitlab replacement'] Upper limit revision: d11648a7a774c8f1bf8450d96f5daf5ee4796a9d
[11:04:40][Compute revision for 'hippo gitlab replacement'] The first revision that was detected in the branch refs/heads/master: ac93a15fc9112d2780ec6de37b202d656724cbcb
[11:04:40][Compute revision for 'hippo gitlab replacement'] Latest commit attached to build configuration (with id <= 86351): d11648a7a774c8f1bf8450d96f5daf5ee4796a9d
[11:04:40][Compute revision for 'hippo gitlab replacement'] Computed revision: d11648a7a774c8f1bf8450d96f5daf5ee4796a9d
But I cannot find the contents of the repository anywhere in the teamcity server. So probably a build step to instruct TeamCity to copy all files from repo would be the solution.
Related
I enable the CI flow between Gitlab to Jenkins.
When I got to Gitlab Portal, only the branchs been created by me are listed there. But when I run the CI flow, from Jenkins console output, it will list extra hundreds branchs with name origin/merge-requests/xxx, xxx is the number from 1 to 156 in my case.
Any idea why and how can I delete these branches?
It is because Jenkins never clean local Git repo which carry a lot of stale remote branch info. These branches already been auto deleted from Git repo.
Inside Jenkins, after install Jenkins Git Plugin, we have two options to help us clean this legacy data:
Source Code Management ==> Additional Behaviors:
Wipe out repository & force clone
Prune stale remote-tracking branches
I fork a project in github. now size of project when i do git clone is about 400 mg.
and size of download zip from github is about 40 mg.
how i can get just last version/snapshot of project and continue commit, or remove all commits for every file except last commit from remote (github)?
git clone --depth 1 --branch=master git://servername/reponame mynewrepo will give you the project without commit history.
I need explicit steps for properly setting up git according to Integration-Manager-Workflow style in a unix environment, from scratch. The catch: It all needs to be done in EGit (so it makes sense to my E-brain), and all the repos are local.
Assuming I have a fresh install of Eclipse w/EGit plugin, what is the best path forward?
In the end, I want to have a project I can clone via git, or import using Eclipse. The blessed repo needs to be at /path/to/blessed/repo/ while the private workspace could be /path/to/src/ and the public code being at /path/to/code/.
I just want to have a project that I can work on in "private", then "Commit and Push" and have it show up in my "public" location. Then, I want to be able to push this "public" location to the "blessed" location. Then, I want to be able to clone the blessed repo with git clone /path/to/blessed/repo/ and see all my branches (and maybe a tag or two) in the final clone.
I think I can implement this via the commandline, but I feel like I am reinventing the wheel on this one... Can this structure be easily implemented in EGit, or is it only possible (or advisable) from the commandline?
This is what I did, just in case there are others out there who can't just default to GitHub for this kind of setup:
Setup Git Integration Manager Workflow in Eclipse
Step by step guide for EGit and Eclipse Kepler. Many of the steps are for the “Integration Manager”, which should be:
A project lead who is also a developer who knows the bigger picture of the project
Based off the command-line syntax from here: treselle.com/blog/git-integration-manager-workflow/
Pre-Requisites
Eclipse Kepler
EGit Pluggin
I did this using Linux, so the file paths will have to be changed if you are working in Windows…
1. Setup the Blessed Repository
In Git perspective > Git Repositories view:
Create a new local Git repository
Now, we can see the Repository in the Git perspective:
blessed_repo.git [NO-HEAD - Bare] - …/code/blessed_repo.git
2. Clone Blessed Repo as Integration Repo
In PyDev > PyDev Package Explorer view:
File > Import...
Displays a branch selection screen, showing Source Git Repository is empty (because we have no branches).
Right-Click on the project: Team > Share Project...
3. Create Master Branch
In Git perspective > Git Repositories view:
Select integration_repo [NO-HEAD]
Show the staging area: Window > Show View > Git Staging
At this point, there should be at least 1 file in the Unstaged Changes (#) section. If not, start over…
Select files to stage (at least 1) as ready for commit.
Right click on the selection: Add to Git Index
(Or drag-drop to Staged Changes)
Now, Staged Changes (#) shows files ready to be committed in the integration_repo.
Add a commit message, maybe similar to: > “Initial project commit”
And Commit the file(s)
Finally, push them back to the blessed repo.
Expand integration_repo [master]
Expand Remotes
Right-click on blessed and Push
Eclipse will show a “Push Confirmation” with “master: master [new branch]” which says that both projects now have a master branch. This branch should remain stable at all times.
4. Create Developer Public
In Git perspective > Git Repositories view:
Create a new local Git repository
Now, tie it to the integration repository.
In Git perspective > Git Repositories view:
Expand integration_repo [master] - /…/code/integration_repo/.git
Right-click on Remotes > Create Remote
Eclipse shows ‘Nothing to fetch - everything is up to date’.
Right-click on developer1 > Push
Shows “Push Results” with “master: master [new branch]”
5. Create Developer Private
This part could be done by Integration Manager and Developers alike
In PyDev > PyDev Package Explorer view:
File > Import...
The sample_project should now be in the Eclipse workspace. Make sure you aren’t trying to import sample_project into a workspace which already has a project with the same name…
6. Developer1 add a feature
This part could be done by Integration Manager and Developers alike
In Git perspective > Git Repositories view:
Expand developer1_working, showing branches
Right click on Branches, Switch to > New Branch...
In PyDev > PyDev Package Explorer view:
Add a new file, file1.py
Add some docstring text
Maybe add a print('python is #1')
In Git perspective > Git Repositories view:
Select developer1_working
Open Git Staging view
Add file1.py to Staged Changes
Add a descriptive commit message
Commit
Expand developer1_working
Expand Remotes
Right-click on integration: Push
Eclipse Shows Push Confirmation, “feature1: feature1 [new branch]” Also shows beneath that: sample_project/file1.py. So we know we commited the added new branch, which includes the addition of the file.
7. Integrate feature into blessed
Now, the Integration Manager will want to pull in the developer changes, test them, and merge with the master branch of the integration repo. Then, push the changes back to developer1 and blessed.
In Git perspective > Git Repositories view:
Expand integration_repo [master] to show Remotes
Expand remotes to show developer1
Right-click on developer1: Fetch
Eclipse shows Fetch Results as “feature1: developer1/feature1 [new branch]”. So, we have brought in this new branch.
Expand integration_repo [master]
Expand Branches
Expand Local
Right-click on master: Merge...
Eclipse will then show the result as a Fast-forward, and New HEAD at the latest commit. So, finally, push to the blessed repo
Expand integration_repo [master]
Expand Remotes
Right-click on blessed: Push
8. Go get beer
Finally, you now have the following repositories all setup:
If no-one ever reads this, well what a waste of 24 hours of my life hahaha O.o
I created a git project from a public github project and I would like to get github project new versions: is it possible from gitlab? is it possible from command line?
With command lines, go into you project folder. Type git remote -v : you should see a remote repo call origin with the address of you repository in gitlab.
Now you can try git remote add origin_github <url_of_github_project>. And then git pull origin_github master should update your repo from GitHub source to your own GitLab repo.
I am trying to configure Android Studio to work with my team repo on Bitbucket. What I would like to do in the first place is to push my local project onto my team's repo.
I have already installed the Bitbucket plugin but don't really know where to go from here. When I try to commit the changes, all I get is "No changes detected".
Without Using Any Plug-in
First from VCS menu of android studio select Enable Version Control Integration, it will ask you for selecting versioning tool, select git from the drop down.
Create new repository in the BitBucket account for the project, selecting git as the repository type.
Now from the terminal window at the bottom of android studio, type: git add -A
This will add the files to git for committing.
To commit with a message type git commit -m "First Commit" in the terminal. Here, First Commit is just a message i used for demonstration.
From Bitbucket, in the newly created repo, select I have an Existing Project from below. It will give you two command line commands. Use Them consecutively. These will add the local repo to the bitbucket. First one: git remote add origin https://example#bitbucket.org/example/test.git
Second one:
git push -u origin master
Add again git add -A
Then Commit git commit -m "Second Commit"
Push for the last time git push origin master
You can check that the branch is up-to-date by writting git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean
Done .
My Android Studio version was 2.3.3 & git version 2.13.0.windows.1
So I am assuming you have a local project and you need to import it into your Repository in BitBucket. Since you already have the BitBucket plugin installed, follow the below steps:
Goto VCS Menu > Import into version control > Share Project
You will have to give your credentials when prompted.
On the next dialogue, give a name and a description to your project and then click OK
Now you have got your project imported to BitBucket. Now to checkout a project from BitBucket:
VCS > Checkout from version control > BitBucket
Select the project you want to checkout
After you have added the project to BitBucket, you will see a menu called Git in you VCS menu, which has all the options of Git.
Now depending on the version of android studio and the BitBucket plugin you are using, you are likely to get some errors while doing these. I did these using Android Studio 0.8.2 and Bitbucket plugin version 1.2.2.
Also make sure in the Android Studio Preferences > Version control, the directory is set to <Project> and the VCS to Git. Unless you are using Mercurial or anything it is advisable to remove any VCS other than Git from there. If all these are right everything should be working well.
There is a bug in the third-party Bitbucket plug-in which is preventing it from working, although you can still configure Android Studio to work with Version Control.
Create a repository on Bitbucket.
Clone it via VCS > Checkout from Version Control > Mercurial or Version Control > Git.
Use the HTTPS or SSH URL shown in the "Clone" tab for the repository on Bitbucket as the Repository URL.
Copy and paste your local project into your cloned repository.
You may now use Android Studio to work the repository.
Android Studio -> VCS -> Enable version control
Right-click on your root directory -> select git -> Add
Then click on ctrl+K
Write your commit msg
Click on Define Remote
Paste your git repository url.
PUSH
//Easy tutorial on android studio with bitbucket (linux)
create bitbucket repository "testp"
create a folder "gtest" on your local machine
go to this local folder("gtest") with cd command
now clone git repository "tesp" with clone command
this repo "testp" folder must come inside that "gtest" folder now
open android studio and create a project "MyApplication" by selecting the project location folder "testp"
now open terminal and go to path with cd command upto that tesp folder (you can use terminal inside android studio)
now hit ls command and it should show your project dir "MyApplication"
on your terminal type command "git add MyApplication/".
10.now enable vcs by clicking menu on vcs and enable vcs ...
once the vcs is set or enable then select your appliation "MyApplication" project >> right click >> git >> commit directory >> may write comment "initial commit" and hit "push and commit" button.
see event log for more detail
check out the repo it should be there.
if you have to pull this project only then goto "MyApplication" project >> right click >> git>> repository>> pull
Note: here "testp" , "gtest" and "MyApplication" are only example
If you have already android project then
select menu(vcs) check out from version control
click clone and copy repository from bitbucket and paste it on dialog given by selecting menu1
On the second menu provide specific location where you want to clone
After clone is success it will ask something like create project, anyways click yes.
Now project is created
6.right click on the project and clik new> add module > import project(this is where you import the already existed android project)
7.After every thing is done, build.gradle may have build problem ,if occur paste following code :
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
}
}
allprojects {
repositories {
jcenter()
}
}
now cd up to your bitbucket clone folder using android terminal
now add everything inside this folder using git command "git add file1 file2 file3"
And lastly right click on your project and goto git>commit directory> commit and push and its done
11.You have your code push and commit on bitbucket : check it out
done
// clone on other computer
clone the bitbucket project using vcs option
and load project(not import) after it get clone
if this not work:
vcs clone to desired directory((click no ,if it ask something like yo have check out an android studio project..Would you like to open it)) and import the project using exact same location of clone directory(use gradle wrapper if asked : it may download so wait) and lastly enable vcs for push and commit.
Here is what you can try.
Android Studio -> VCS -> Enable version control
Android Studio -> Changes
Review all files and commit. At this stage you might have to add your files
to VCS manually.
Now you can share it on Bitbucket by
VCS-> Share it on Bitbucket
Note:- For bitbucket you will have to install "following Bitbucket plugin"
for Android Studio. http://plugins.jetbrains.com/plugin/6207?pr=androidstudio
You need to add the files to your local repository first.
Go to menu VCS -> Show Changes View.
Add all the files.
Then got to menu VCS -> Import into Version Control -> Share project.
You will be ask to enter the bitbucket origin URL. And that's it.