1. 程式人生 > >解決本地建立了程式碼庫.git檔案,想clone遠端庫,出現git fatal: destination path '*' already exists and is not an empty

解決本地建立了程式碼庫.git檔案,想clone遠端庫,出現git fatal: destination path '*' already exists and is not an empty

出現這個問題時,百度一下,出現這個答案:

原部落格地址:https://blog.csdn.net/u011687186/article/details/75277533

網上說需要刪除或者重新命名已經存在的本地檔案,然後在clone 其實不用。

第一步 :進入到已存在的目錄  cd (/file)

第二步: 初始化git  init

第三步: 新增遠端倉庫地址  git remote add origin  (address)

第四步:  新增原生代碼  git add .

第五步: 提交原生代碼 git commit -m "init"

第六步: 提交到遠端倉庫 git push origin master 

但是又出現了一個問題:

error: failed to push some refs to '[email protected]:xxx/xxx.git'

於是百度,出現這個答案:

原部落格地址:https://blog.csdn.net/u011471873/article/details/51462871

$ git push -u origin master
To [email protected]:xxx/xxx.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to '[email protected]
:xxx/xxx.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint: (e.g., 'git pull ...') before pushing again. hint: See the
'Note about fast-forwards' in 'git push --help' for details.
原因: 
GitHub遠端倉庫中的README.md檔案不在本地倉庫中。 

解決方案:

$ git pull --rebase origin master
$ git push -u origin master
根據以上,解決了我的問題。感謝以上兩位博主。

相關推薦

解決本地建立程式碼.git檔案clone遠端出現git fatal: destination path '*' already exists and is not an empty

出現這個問題時,百度一下,出現這個答案:原部落格地址:https://blog.csdn.net/u011687186/article/details/75277533網上說需要刪除或者重新命名已經存在的本地檔案,然後在clone 其實不用。第一步 :進入到已存在的目錄  c

fatal: destination path '.' already exists and is not an empty directory.如何 clone git 專案到一個非空目錄

解決的辦法是: 1. 進入非空目錄,假設是 /workdir/proj1 2. git clone --no-checkout https://git.oschina.net/NextApp/platform.git tmp 3. mv tmp/.git .   #將 tmp 目錄下的 .git 目

fatal: destination path '.' already exists and is not an empty directory. 錯誤及解決辦法

今天在使用Git for Windows clone程式碼時,遇到了題目所示的錯誤,簡單來說就是目標路徑‘.’已經存在並且不是一個空目錄。 可是在我在資料夾下並沒有看到任何檔案,顯示“該資料夾為空”,然後自然而然地,我想到了這個'.'路徑是不是被Windows隱藏了? 於是

git push遠端倉庫時報錯:fatal: remote origin already exists. (已解決

   在做遠端倉庫除錯階段,突然發現修改後的專案無法push了:  如果輸入$ git remote add origin [email protected]:djqiang(github帳號名)/gitdemo(專案名).git   

git_在本地建立Git倉庫初次如何推送到GitHub?

本文針對本地命令列Git推送到GitHub的一個特定問題提供解決方案 問題前提: 已經在命令列git中配置好了ssh key的童鞋。沒配置好可以按照GitHub官方的步驟一步步執行下去即可完成配置。 問題描述: 如在本地建立了一個倉庫,名為aaa,並已經使用gi

解決本地SqlServer無法連接遠程服務器數據錯誤10060

安全組 nbsp png .com 配置 火墻 serve cmd mage 本地SqlServer 連不上服務器的數據庫環境,錯誤信息如下圖,折騰來折騰去,最終還是解決了 第一步   查看服務器本地端口是否已經打開,查看方法:首先向C:\Windows\System32

Git 提示fatal: remote origin already exists 錯誤解決辦法

倉庫 remote gin rem config文件 add fbi already fat 今天使用git 添加遠程github倉庫的時候提示錯誤:fatal: remote origin already exists. 最後找到解決辦法如下: 1、先刪除遠程 Gi

gitGit 提示fatal: remote origin already exists 錯誤解決辦法

遠程 分享 mage mod dal -s lock 解決 ack 今天使用git 添加遠程github倉庫的時候提示錯誤:fatal: remote origin already exists. 最後找到解決辦法如下: 1、先刪除遠程 Git

Git 提示fatal: remote origin already exists 錯誤怎麼解決

今天連線遠端倉庫得時候報了一個錯誤:fatal: remote origin already exists  這個呢解決只需兩步 1.先刪除遠端git倉庫 git remote rm origin 2.在新增到遠端倉庫就行了 git remote add origin

git 原生代碼到遠端

如何用命令將本地專案上傳到git 1、 開啟git bash ,cd 進入到程式碼所在資料夾(或者在程式碼所在資料夾裡,右鍵點選get bash here) 2、通過命令  git init  把這個目錄變成git可以管理的倉庫 git init 3、使用命令 gi

git入門學習(四)從遠端克隆

git 入門學習第四課 說明 開動!!!!!!!!!!!!! 結束 說明 只是單純的記錄學習過程 開動!!! 我們從零開始,首先登入GitHub建立一個新的倉庫,這回我們勾選 Initialize this

Git 學習筆記 - 10 - 從遠端克隆

Git 學習筆記 - 10 - 從遠端庫克隆 注:本文參照的是廖雪峰老師的Git教程 概述: 之前練習的是怎麼從本地關聯遠端倉庫,然後將本地倉庫的程式碼上傳到遠端倉庫中。 在實際生活中,比如來到一家新公司,需要從公司的倉庫中下載你即將要開發的專案程式碼來熟悉,這是就需要將遠端

Git 學習筆記 - 09 - 新增遠端

Git 學習筆記 - 09 - 新增遠端庫 注:本文參照的是廖雪峰老師的Git教程 概述: 當前我們已經在本地有了一個本地的 Git 倉庫,遠端的話我們已經申請好了GitHub賬號,現在我們需要建立一個遠端倉庫來實現程式碼的遠端管理。 步驟: 1. 先在GitHub上建立

eclipse git上傳專案到遠端

第一部分: 1.環境準備jdk、eclipse、git安裝,這裡不進行解釋。 第二部分: 2.建立一個maven專案 3.在碼雲(或githup)上建立一個分支 4.右鍵專案,team—>share project ->git 5.點

解決git提交報錯:fatal: remote origin already exists.

1.git remote rm origin 2.git init 3.git add . 4.git remote add origin [email protected]:z5.qaly

GIT:fork和clone的區別fetch與pull的區別

[1] .cn linu fork bsp sina 指南 lin name 參考資料: [1].Git學習筆記:fork和clone的區別,fetch與pull的區別 [2].在Github和Git上fork之簡單指南 GIT:fork和clone的區別,fetch與p

git報錯:'fatal:remote origin already exists

目錄 eas repo syn baidu for .cn com 分享 git報錯:‘fatal:remote origin already exists‘怎麽處理?附上git常用操作以及說明。 git添加遠程庫的時候有可能出現如下的錯誤, 怎麽解決? 只要兩步

解決使用maven的java web項目導入後出現的有關問題 -cannot be read or is not a valid ZIP file

valid 鏡像 項目 bsp 阿裏 可能 錯誤 mini java 錯誤問題:雖然查找repository目錄下是有jar包,但是jar包是有問題的(可能是下載不完整),所以更改鏡像地址到國內。 解決方案: 1)刪除提示錯誤路徑下的所有jar包(C:

git錯誤fatal: remote origin already exists.

rem ready bsp str mce nbsp exist 輸入 strong 輸入 $git remote add origin https://github.com/用戶名/項目.git,提示fatal: remote origin already exists.

fatal: remote origin already exists. (遠端來源已經存在 解決辦法)

在當我們輸入` git remote add origin https://gitee.com/(github/碼雲賬號)/(github/碼雲專案名).git ` 就會報如下的錯 fatal: remote origin already exists.   翻譯過來