如何通过终端git bash访问现有的git存储库?

时间:2017-05-25 01:17:09

标签: git bash github

我有一个GitHub存储库,我现在想要访问然后分支。我使用GitHub桌面创建了存储库。但是,我想通过终端访问此存储库,然后分支它。我已尝试将cd作为url链接,以及终端中的以下内容:

$ git init
Reinitialized existing Git repository in C:/Users/tracyandgrant/Documents/Treehouse notes/portfolio/.git/

$ git status
On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)

        experience.html
        images/
        index.html
        styles.css

nothing added to commit but untracked files present (use "git add" to track)

$ git add .
warning: LF will be replaced by CRLF in index.html.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in styles.css.
The file will have its original line endings in your working directory.

$ git commit -m 'initial commit with git bash'
[master 8c29fcb] initial commit with git bash
 9 files changed, 509 insertions(+)
 create mode 100644 experience.html
 create mode 100644 images/WorldMap.gif
 create mode 100644 images/github.svg
 create mode 100644 images/kiwiicon.jpg
 create mode 100644 images/landscape.jpg
 create mode 100644 images/otago-logo.png
 create mode 100644 images/treehouse.png
 create mode 100644 index.html
 create mode 100644 styles.css

$ git remote add origin git@github.com:TracyExcell/Portfolio.git

$ git push -u origin master
The authenticity of host 'github.com (192.30.255.112)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)?
Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

$ git remote add origin https://github.com/TracyExcell/Portfolio
fatal: remote origin already exists.


$ cd https://github.com/TracyExcell/Portfolio
bash: cd: https://github.com/TracyExcell/Portfolio: No such file or directory

如果你知道怎么做,请你帮忙。谢谢。

1 个答案:

答案 0 :(得分:0)

您不需要重新初始化回购。你想要做的是分叉一个存储库,如果它不是你的,并设置一个单独的遥控器 - 名为upstream和origin。分支是该问题的外部因素,但您将看到2组远程跟踪分支。