我在git init
的服务器上创建了一个repo。它位于learning.example.com/gitdir/.git
现在我想从我的本地计算机上推送它,但我不明白如何做到这一点。
我创建了一个本地仓库
git init
添加了一个文件(index.html
)
git add index.html
git commit -m "initial commit"
现在我在这里混淆了。我的教程说要输入git remote add origin git@gitserver:/opt/git/project.git
。所以我试过了:
git remote add origin git@learning.example.com/gitdir
git push origin master
......但是挂了一会儿之后就给了我:
ssh: connect to host learning.example.com port 22: Operation timed out
fatal: Could not read from remote repository
Please make sure you have the correct access rights and the repository exists.
我很确定我有正确的访问权限,但我想也许我只是误解了路径。
更新:
我已经修改了一些东西而且我得到了一个稍微不同的错误,这让我觉得我越来越近了。本地:
git remote add try6 ssh:myusername@learning.example.com:21098/public_html/learning/git
git push try6 master
myusername@learning.example.com's password: []
bash: git-receive-pack: command not found
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
至少我登录了那个时间,对吧?我在路径上尝试了一些变体,包括/public_html/learning/git.git
,/git.git
和/git
。