How do I put a new Git repo to an SVN server? - linux

I have a git repo that I want to push to my SVN server. So I followed some tutorials on the web and I always end up with the same message.
$ git svn dcommit
Unable to determine upstream SVN information from HEAD history.
Perhaps the repository is empty. at /usr/libexec/git-core/git-svn line 866.
Here is the latest steps I followed
https://stackoverflow.com/a/981765/1814930
I am on Cygwin64 and the SVN server is running on Debian Wheezy.

Related

How to pull a new-create file from server repository by svn?

I've already install subversion in my centos server.
I created a new file named "test" in server's repository.How can I pull this file to my local repository?
What I've done:
I typed svn add test ,then svn commit test in command line,and then I updated in my PC's repository,but nothing happened.
I am a newbie.Thanks in advance!
Finally.I know how the svn work.
I should create a svn repository in centos first, then add and commit that file to that repository ,and then checkout on PC.

Sync directory with git repo on new commit

How can I sync a directory with a git repo? When there are new commits to the repo I want the directory aswell. The process should be fully automated.
The git repo is a laravel installation, we're working on this installation with multiple devs, we would like to see our commits live. So thats why I have this problem.
I want to do this in CentOS 7 and Gitlab as my git host.

How to add a git repository to Ubuntu server

I have a node.js project local in my computer, right now, I want to push this project to remote Ubuntu server. I have create a project.git on Ubuntu server, and pushed to it. Right now, I want to run this project on the server, but how do I access this folder, it's just a git directory. The process I am following is like below:
Ubuntu server:
mkdir /home/git/project
cd /home/git/project
git init
Local computer:
git remote add origin root#someserver.com:/home/git/project
git add .
git commit -am "Initial Commit"
git push origin master
It push succeed. Right now, I want to execute this node.js project and run it on the server, but how to turn this git repository to a folder, so I can cd into it and then node app.js after?
If you want to see the code on the server side, you should init the repository without --bare option or clone it somewhere else on the server.
Bare repositories store only git specific files.
UPDATE:
If you create a repository without --bare option, you can't push anything to that branch where your server is staying. Better solution is if you create a bare repository and clone it somewhere else on the server. Notice that, you should use there git pull command if you want to see your fresh code.

Git - Syncing a Github repo with a local one?

First off, forgive me if this is a duplicate question. I don't know anything but the basic terminology, and it's difficult to find an answer just using laymen's terms.
I made a project, and I made a repository on Github. I've been able to work with that and upload stuff to it for some time, on Windows. The Github Windows application is nice, but I wish there was a GUI for the Linux git.
I want to be able to download the source for this project, and be able to edit it on my Linux machine, and be able to do git commit -m 'durrhurr' and have it upload it to the master repository.
Forgive me if you've already done most of this:
The first step is to set up your ssh keys if you are trying to go through ssh, if you are going through https you can skip this step. Detailed instructions are provided at https://help.github.com/articles/generating-ssh-keys
The next step is to make a local clone of the repository. Using the command line it will be git clone <url> The url you should be able to find on your github page.
After that you should be able to commit and push over the command line using git commit -am "commit message" and git push
You can use SmartGit for a GUI for git on Linux: http://www.syntevo.com/smartgit/index.html
But learning git first on the command line is generally a good idea:
Below are some basic examples assuming you are only working from the master branch:
Example for starting a local repo based on what you have from github:
git clone https://github.com/sampson-chen/sack.git
To see the status of the repo, do:
git status
Example for syncing your local repo to more recent changes on github:
git pull
Example for adding new or modified files to a "stage" for commit
git add /path/file1 /path/file2
Think of the stage as the files that you explicitly tell git to keep track of for revision control. git will see the all the files in the repo (and changes to tracked files), but it will only do work on the files that you add to a stage to be committed.
Example for committing the files in your "stage"
git commit
Example for pushing your local repo (whatever you have committed to your local repo) to github
git push
What you need to do is clone your git repository. From terminal cd to the directory you want the project in and do
git clone https://github.com/[username]/[repository].git
Remember not to use sudo as you will mess up the remote permissions.
You then need to commit any changes locally, i.e your git commit -m and then you can do.
git push
This will update the remote repository.
Lastly if you need to update your local project cd to the required directory and then:
git pull
To start working on the project in linux, clone the repo to linux machine. Add the ssh public key to github. Add your username and email to git-config.
For GUI you can use gitg.
PS : Get used to git cli, It is worth to spend time on it.

Clone a git-svn repo by getting all of the svn part from the original svn repo

How can I clone a git repo from my laptop (at home) to a server (at university) while getting most of the repo from a third (svn) repo at another uni that is the main codebase. I'd like to minimise the amount of home<->uni traffic by maximising uniOne<->uniTwo traffic.
this is what I have now on Laptop:
--o--o--o---o---o---o git-svn trunk
`--o--o-o--o git mybranch
this is what I would like to get on uniOne:
--o--o--o---o---o---o git-svn trunk <-- from uniTwo
`--o--o-o--o git mybranch <-- from Laptop
After cloning the repo should be able to pull branches from Laptop.
I have tried: on uniOne: git-svn clone uniTwo, git remote add Laptop, but then git fetch wants to get the whole thing from Laptop. I thought maybe using git clone --depth x Laptop and then graft them together might work but it still requires all of the source files to be transfered Laptop->uniOne, not just the changes. I could try to export all patches from Laptop and apply them on top of a fresh svn checkout then get it to track the branch on my Laptop (if that is possible) but it would be easier to wait until I am next at uni and then just clone normally.
Let's define your repositories:
git-svn <-- this is the Subversion repository at University
uni/master <-- this is a Git repository at your University. This is jus a "fetching repository" that gets the latest history from the Subversion repo.
laptop/master <-- This is the Git repository on your laptop. This is where you work.
I would suggest the following setup:
Create uni/master by doing git svn clone of git-svn.
Automatically or regularly update uni/master with the latest changes from git-svn by running git svn rebase (trigger with a commit hook, cron-job, or manually every time you're at Uni).
Create laptop/master by cloning uni/master. Here you can commit locally as often as you want. When you are at University, get the latest changes from uni/master by running git pull --rebase (you always have to do --rebase to keep history linear, because SVN won't understand git-branches).
When you want to push changes from your laptop back to git-svn, you have to configure the git-svn remote on your laptop/master first:
git svn init https://url.to.uni-svn-repo
Now you can push your latest changes back to uni-svn with git svn dcommit. Note that you might have to update the reference to the latest commit in uni/master first. first:
git update-ref refs/remotes/git-svn refs/remotes/uni/master
DO NOT attempt to push from your laptop/master to uni/master. This will only bring chaos as the rebasing/rewriting history will just confuse Git when it tries to sync with git-svn again.
See also http://www.tfnico.com/presentations/git-and-subversion where I've started collecting up a bunch of tips for working with Git and SVN together.

Resources