添加git远程存储库的问题

时间:2011-02-18 01:28:02

标签: git

我在向本地存储库添加远程存储库时遇到问题。我首先尝试使用Tower来管理我添加本地仓库,但是当添加远程仓库时,它只是添加了URL。它没有说明这个URL。它应该包括ssh://我的用户名等等。

所以我找到了this article并严格遵循它,直到添加远程存储库。它失败了。有人可以帮忙吗?

Kasper-Srensens-MacBook-Pro:~ Kasper$ git remote add origin ssh://kasperso@kaspersorensen.com:2227/www/mechatronicscluster/wp-content.git fatal: Not a git repository (or any of the parent directories): .git Kasper-Srensens-MacBook-Pro:~ Kasper$

3 个答案:

答案 0 :(得分:8)

您必须位于git存储库中才能为此特定存储库添加远程 。 使用cd更改当前目录。

答案 1 :(得分:3)

注意:如果您必须在该确切的git存储库之外执行该命令,那么can set the GIT_DIR environment variable

(
    GIT_DIR=/somewhere/else/.git; export GIT_DIR
    git <command>...
)

或只是使用命令的 --git-dir 选项

    git --git-dir=/somewhere/else/.git <command>...

那将是不需要在工作树中的命令(已检出的Git存储库)。 git remote add符合此标准。

答案 2 :(得分:0)

使用例如bitbucket,您可以通过他们的Web服务轻松创建远程分支,然后在Tower中获取远程存储库(它将添加新的分支图标)

相关问题