2011-04-15 72 views
0

我有托管,让我ssh访问。git推到裸仓库,然后拉不工作

我创建了裸仓库。下班前我在哪里推。但是,当我从那里提出更改时,它不起作用。

[email protected] ~/www/project $ git push 
Everything up-to-date 

配置为:

[email protected] ~/www/project $ git config -l 
core.repositoryformatversion=0 
core.filemode=true 
core.bare=false 
core.logallrefupdates=true 
remote.origin.url=ssh://[email protected]/~/project.git 
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/* 
branch.master.remote=origin 
branch.master.merge=refs/heads/master 

然后家里的电脑:

[email protected] /var/www/project $ git pull 
Already up-to-date. 


[email protected] /var/www/project $ git config -l 
core.repositoryformatversion=0 
core.filemode=true 
core.bare=false 
core.logallrefupdates=true 
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/* 
remote.origin.url=ssh://[email protected]/~/project.git 
branch.master.remote=origin 
branch.master.merge=refs/heads/master 
gui.wmstate=normal 
gui.geometry=962x330+284+384 207 192 

如果每一件事情是UPTODATE和已经高达日期,那么为什么它们有什么不同?我如何使用这个设置。我应该打开他们两个同步,没有帮助我的托管ssh访问?

+0

这篇文章被标记为“git-svn”,但没有其他引用svn。我错过了什么? – nobar 2011-04-16 00:47:10

+0

我认为我使用存储库的方式看起来完全如何svn工作。 – nerkn 2011-04-16 05:18:26

回答

0

当您运行git config时看到的配置存储在本地,每个存储库,它不在存储库之间共享(因此它不会被推送到服务器,也不会被拉下;它完全在本地管理)。您的配置由如何管理存储库的设置组成,这些设置可能需要在不同的机器上有所不同,甚至在同一台机器上有不同的回购机制,所以Git不管理存储库配置的内容,也不在回购之间共享它。

为了看到这两个仓库之间的更新文件,创建或一个内编辑文件时,使用阶段的git add filename文件,使用git commit承诺,然后推。从其他存储库中取出时,应该会看到新的或更新的文件。

+0

我运行git commit:D它按照我的预期工作。首先承诺然后推。没有其他分支比主分支我有。问题我添加了很多文件,目录但我需要明确地添加它们,提交 - 没有帮助。 – nerkn 2011-04-16 05:41:51

2

由于您使用的是git push而没有任何其他参数,因此很难判断您在笔记本电脑和台式机上使用哪个分支。如果你只在master分支上工作,git push应该可以工作,因为你在一个远程源代码分支。但是,如果您在另一个分支中,那么很可能您将其创建为默认方式,从而创建本地分支。然后您需要使用git push origin mybranchname(或将您的更改合并到另一个分支,可能是主分支)显式推送该分支到回购。

P.S.伟大的Matthew Mccullough在过去的NFJS上展示了一个伟大的bash提示设置,以显示git状态,包括当前分支和脏状态。我在这里修改了一个版本https://gist.github.com/235332,这是Matthew的要点。它可能会派上用场,以便跟踪你所在的分支。