1

I imported an existing svn-repo into my preset git repo using the git svn clone http://svn/repo/here/trunk command. Now I can see all the logs of the svn commits done after firing the git log command.

I want to push these files to github, but git add and git commit do not show any files for the same.

So which command will add and commit these files to the remote git repo?

eminemence
  • 721
  • 1
  • 6
  • 21

1 Answers1

0

git svn already added and committed those files to your local repo.

Make sure git is configured with the right username and email (ie the ones of your GitHub repo):

git config --global user.name "Name"
git config --global user.email email@gmail.com

You need to add a remote to your GitHub repo and push.

cd /path/to/your/local/repo
git remote set-url origin https://username@github.com/username/reponame
git push --all
git push --tags

Note that when you create a brand new repo on GitHub, it might comes with already one commit (with one file, the README.md).
In that case, the git push from your local repo might be rejected, because the history of your repo isn't based on that one commit of your GitHub repo.

If that is the case (failed git push), then:

cd /path/to/your/local/repo
git remote add origin https://username@github.com/username/reponame
git pull origin master
git push --all
git push --tags
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • The `git remote add` command is giving me this message `fatal: remote origin already exists.`. Tried the sequence of commands but nothing was added to the remote repo. – eminemence Oct 06 '13 at 15:37
  • @eminemence then try `git remote set-url` (I have changed the answer) – VonC Oct 06 '13 at 15:48
  • Thanks for the answers till now. `git remote` worked fine this time. But both the `git push`'s returned `Everything up-to-date`. Never thought svn to git migration would be such a headache. Just to add, I have tried running the svn2git tool, but as I am on windows, it's not running fine. Hence I took up the tasks of manually importing svn to git. – eminemence Oct 06 '13 at 16:49
  • @eminemence then might I recommend subgit? See http://stackoverflow.com/a/19156792/6309 But make sure first your GitHub repo doesn't already contain the svn repo history. – VonC Oct 06 '13 at 16:51
  • none of the above methods have worked. I am not marking this as an answer in the hope of some solution. – eminemence Oct 10 '13 at 08:29
  • @eminemence I would still recommend subgit. – VonC Oct 10 '13 at 08:34