开发者

Problems adding git remote repository

I'm having problems adding a remote repository to my local one. I first tried using Tower where I manged to add my local repo, but when it came to adding a remote repo it just开发者_如何学C said add the URL. It doesn't say anything about this URL. Should it include ssh:// my username etc. etc.

So I found this article and followed it precisly, until it came to adding a remote repository. It failed. Can anyone help?

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$


You have to be in a git repository to add a remote for this specific repository. Use cd to change the current directory.


Note: if you had to execute that command outside of that exact git repository, you can set the GIT_DIR environment variable:

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

or simply using the --git-dir option to your command

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

That would be for commands which don't need to be in a working tree (a checked out Git repository). git remote add fits this criteria.


Using for example bitbucket you can easily create remote branch through their web service and then fetch remote repository in Tower (it will add new branch icon)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜