2017-05-25 61 views
-1

我有一个GitHub存储库,我现在想要访问然后分支。我使用GitHub桌面创建了存储库。不过,我想通过终端访问这个存储库,然后分支它。我已经尝试了cd作为url链接,并在终端中的以下内容:如何通过终端git bash访问现有的git存储库?

$ 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 [email protected]: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 

如果你知道如何做到这一点,请你帮忙。谢谢。

+0

首先看看文档如何brach,https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell – KeithC

+0

我认为你需要设置SSH证书,以便您可以连接到回购和推送。 https://help.github.com/articles/connecting-to-github-with-ssh/ – eftshift0

回答

0

你不应该需要重新初始化回购。你想要做的就是派生一个仓库,如果它不是你的,并且设置一个单独的远程控制器 - 命名为上游和原点。分支是这个问题的外部,但你会看到2套远程跟踪分支。

相关问题