开发者

git push to bare repository then pull dont work

I have hosting that give me ssh access.

I created bare repository. Where I push before leaving work. But when I pull changes from there it is not working.

nerkn@nerkn-laptop ~/www/project $ git push
Everything up-to-date

config is:

nerkn@nerkn-laptop ~/www/project $ git config -l
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=ssh://user@domain.com/~/project.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master

Then home computer:

nerkn@nerkn-desktop /var/www/project $ git pull
Already up-to-date.


nerkn@nerkn-desktop /var/www/project $ git config -l
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.fetch=+refs/heads/开发者_Go百科*:refs/remotes/origin/*
remote.origin.url=ssh://usre@domain.com/~/project.git
branch.master.remote=origin
branch.master.merge=refs/heads/master
gui.wmstate=normal
gui.geometry=962x330+284+384 207 192

If every thing is uptodate and already upto date then why are they different? How I can use this setup. Should I open both of them to sync, without help of my hosting ssh access?


Since you're using git push without any other parameters, it's difficult to tell which branch you're in on your laptop and desktop. If you are only working in the master branch, git push should work, since you're in a remote-sourced branch. However, if you are in another branch, mostly likely you created it the default way, which creates a local branch. You would then need to explicitly push that branch to the repo using git push origin mybranchname (or merge your changes into another branch, possibly the master branch).

P.S. The great Matthew Mccullough was showing a great bash prompt setup at a past NFJS to show the git status, including the current branch and dirty state. I have a tweaked version here https://gist.github.com/235332, a fork from Matthew's gist. It might come in handy for tracking which branch you're in.


The config that you see when you run git config is stored locally, per repository, it is not shared between repositories (so it will not be pushed to the server, nor pulled down; it is managed entirely locally). Your config consists of settings for how to manage the repositories, which may need to be different on different machines or even different repos on the same machine, so Git doesn't manage the contents of the repository configuration nor share it between repos.

In order to see files being updated between the two repositories, create or edit a file within one, stage the file using git add filename, commit using git commit, and then push. When you pull from your other repository, you should see the new or updated file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜