簡體   English   中英

在GIT中將現有目錄創建為存儲庫

[英]Create Existing Directory as Repository in GIT

我有一個目錄說cplusplus_learn ,我的用戶名是apex_user (說)在git中 在cplusplus_learn中,有一些我正在練習C ++語言的文件和目錄。 我想創建一個與cplusplus_learn同名的存儲庫,並在GITHUB網站上推送所有東西。 有人可以向我解釋完成這一步驟的完整步驟。 我經歷了各種各樣的鏈接但完全糊塗了。 大多說已經有回購。

轉換存在,非空目錄到-A-混帳工作目錄

GitHub的錯誤-庫未找到致命

注意:我想從終端做的所有事情。

$ cd cplusplus_learn
$ git init .
$ git commit -m 'My first commit'
$ git remote add origin https://github.com/apex-user.git
fatal: remote origin already exists.
$ git push -u origin master
fatal: repository 'https://github.com/apex-user/' not found

以上就是我試過的。 我知道有什么不對,但我無法弄明白。

首先,您需要登錄您的github帳戶並創建名為cplusplus_learn的存儲庫

我想從終端做的所有事情。 就像你已經描述過的那樣。 根據您的描述,您似乎已經設置了錯誤的遠程URL,因此您需要更新或重置它,如下所示

$ cd cplusplus_learn
$ git init 
$ git commit -m 'My first commit'
$ git remote set-url origin https://github.com/apex-user/cplusplus_learn.git
$ git push -u origin master

希望這應該工作。 謝謝 :)

  • 將SSH密鑰添加到Github配置文件設置中。
  • 在Github上創建一個存儲庫。 例如(RepoName)
  • 導航到項目目錄cplusplus_learn
  • 初始化git git init
  • git remote add origin https://github.com/apex-user/RepoName.git
  • git add -A
  • git commit -m "Message you would like to put"
  • git push origin master

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM