user1246462
user1246462

Reputation: 1278

Git checkout from repository on GitHub into an existing local repository based on SVN

I recently migrated a project to GitHub from Subversion but the current working local directory is still an SVN local repository. Due to complicated reasons it wouldn't be good to make a new git clone local repository so is there any way to check out the git repository from GitHub?

Right now it's giving me the error:

fatal: Not a git repository (or any parent up to mount parent )
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set)

Obviously since I'm not using a git local repository.

Upvotes: 2

Views: 666

Answers (3)

bentolor
bentolor

Reputation: 3426

It sounds like your core issue is that you try to keep a Subversion and a Git repository in sync in such way, that Git should be only an additional view on to your Subversion repository. If this is the case SubGit might be a solution: It provides a Git mirror of a Subversion repository so you could just stick to Subversion on your machine while having also the additional Git repository.

Upvotes: 3

dahlbyk
dahlbyk

Reputation: 77600

  1. git init in your Subversion working directory will make it a git repository.
  2. git remote add origin <url>, where <url> is the HTTPS or SSH path from GitHub, will connect your local repository to GitHub.
  3. git fetch origin will update your local Git repository with all its history from GitHub
  4. git reset origin/master will point your local master branch to the latest master from origin, without changing of your files.

At this point git status will show you any differences between your local working directory and what's on GitHub.

Upvotes: 4

Borealid
Borealid

Reputation: 98559

You cannot create an "SVN checkout" of a git repository.

In git, cloning a repository includes all of its history. git tools rely on this to perform their functions. In SVN, all the history is on the server and the local side is just a working copy.

You're going to have to do a git clone. The closest knockoff to how SVN works would be to do a clone with --depth=1, but the resulting checkout would be pretty badly crippled.

If you were to want to do the inverse of what you're asking - that is to say, you want to use a local git client with an upstream SVN repository - the answer would be git-svn.

If you just want to minimize the amount redownloaded - you only said "complicated reasons", so I can't reason about your motives - just keeping the local files isn't going to be enough. As I mentioned, git stores not only the latest version of the files but also every past revision. That past version information will have to be downloaded no matter what you do.

Upvotes: 0

Related Questions