import local git repo to remote server repo
Update - known issue with git-enterprise. Used unfuddle and subtree merge works now
I've been developing locally only on my machine using Git. It has never been pushed to a remote repo.
I just signed up for an account on enterprise git. I now want to import my local repo to the newly created remote git repo and maintain the history.
Tried to follow the answer here, though receive
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error:
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update 开发者_如何学Pythonits work tree to match what you pushed in some
remote: error: other way.
remote: error:
remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
So then tried
git clone repourl/project.git
cd project
git remote add other /tmp/myproject
git checkout master
git commit
git push
When I did git commit received
On branch master
nothing to commit (working directory clean)
Doing git push receive
Everything up-to-date
Though if I do "ls" I see all my files. If I do "git log" I see my version history.
Wouldn't a simple push do the job?
Here is what I think is needed:
- Add the enterprise git as a remote to your existing local repo(which has all the data).
- Then a
git push <enterprise-remote-name> <branch-name>
will push the specified branch on your local repo to the enterprise repo, will all it's commit history.
I haven't used enterprise git, but I use github everyday and the above two steps will do what you are looking for.
Switched to github and bitbucket private repo. enterprise-git too buggy at least when I was trying
Just in case someone looks for a solution when you're also in charge of the remote server: Init the server's repository with git init --bare
instead of just git init
.
精彩评论