2017-05-25 93 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套遠程跟蹤分支。

相關問題