对于这个项目,我远离两个实例(从家里)和使用PuTTY和SSH
$school
=学校
$aws
=亚马逊网络服务(运行Puppet的实例)
$school
创建的 git init --bare githubdir
git
branches config description HEAD hooks info objects refs
使用创建 $aws
git
Mkdir githubdir && cd githubdir
git init
git remote add origin studentID@$school:githubdir
我需要从$school
推送到运行Puppet的$aws
来执行$school
我需要从$school
我已成功从$school
推送到$aws
,但我想为版本控制设置分支,但是我在$school
上遇到致命错误:
[studentID@$school githubdir]$ git status
fatal: This operation must be run in a work tree
[studentID@$school githubdir]$ git branch
* master
v1
[studentID@$school githubdir]$ git checkout master
fatal: This operation must be run in a work tree
[studentID@$school githubdir]$
[studentID@$school githubdir]$ git log
commit 3abd0c361ee*********
Author: Ben*** <studentID@$school>
Date: Date
first commit to the repo test
我可以在$aws
上分支/结帐等等:
[awsUser@$aws githubdir]$ git status
# On branch master
nothing to commit, working directory clean
[awsUser@$aws githubdir]$ git branch
* master
[awsUser@$aws githubdir]$ git checkout master
Already on 'master'
[awsUser@$aws githubdir]$ git log
commit 3abd0c361ee*********
Author: Ben*** <studentID@$school>
Date: Date
first commit to the repo test
[awsUser@$aws githubdir]$ ls
firstFile
[awsUser@$aws githubdir]$
我的理解不正确吗?我被指示以这种方式设置,但似乎我被告知要在$aws
中写信并推送到$school
?
注意:您没有给我任何作业或分级类型问题的解决方案,这纯粹是我对环境和可能的执行流程的问题?
谢谢!
答案 0 :(得分:1)
但似乎我被告知用$ aws写作并推送到$ school?
是的:您应该推送到 bare repo (即没有工作树的回购,没有实际文件)
这就是为什么你会看到像
这样的错误[studentID@$school githubdir]$ git status
fatal: This operation must be run in a work tree
答案 1 :(得分:1)