在Linux中利用git將something傳到GitHub上的方法
從11.3號就開始嘗試將something利用git傳到自己的GitHub上,但是一直不成功,會提示各種各樣的fatal,例如:
一:
fatal: remote origin already exists.
解決方式:git remote rm origin
二:
! [rejected] master -> master (fetch first) error: failed to push some refs to '[email protected]:Eider1998/myGitTest.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檔案不在原生代碼目錄中;
也就是說如果我現在處於的目錄是myGitTest,我現在想要將README.md利用我的git上傳到我的Github上去,
但是,我現在根本就沒有touch README.md,所以會導致上傳不成功!
解決方法:
[email protected]:~/myGitTest$ cat README.md
cat: README.md: No such file or directory
[email protected]:~/myGitTest$ touch README.md
[email protected]:~/myGitTest$ git status
On branch master
Untracked files:
(use "git add <file>..." to include in what will be committed)
README.md
nothing added to commit but untracked files present (use "git add" to track)
[email protected]:~/myGitTest$ git add README.md
[email protected] :~/myGitTest$ git status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: README.md
[email protected]:~/myGitTest$ git commit -m "First commit"
[master b79497b] First commit
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 README.md
[email protected]:~/myGitTest$ git status
On branch master
nothing to commit, working tree clean
[email protected]:~/myGitTest$ git remote add README.md [email protected]:Eider1998/myGitTest.git
fatal: remote README.md already exists.
[email protected]:~/myGitTest$ git pull --rebase README.md master
From github.com:Eider1998/myGitTest
* branch master -> FETCH_HEAD
Current branch master is up to date.
[email protected]:~/myGitTest$ git push -u README.md master
Warning: Permanently added the RSA host key for IP address '52.74.223.119' to the list of known hosts.
Enumerating objects: 10, done.
Counting objects: 100% (10/10), done.
Delta compression using up to 4 threads
Compressing objects: 100% (8/8), done.
Writing objects: 100% (9/9), 944 bytes | 188.00 KiB/s, done.
Total 9 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), done.
To github.com:Eider1998/myGitTest.git
adbad68..b79497b master -> master
Branch 'master' set up to track remote branch 'master' from 'README.md'.
注:該錯誤的解決方法:
[email protected]:~/myGitTest$ git remote add README.md [email protected]:Eider1998/myGitTest.git
fatal: remote README.md already exists.
方法:
[email protected]:~/myGitTest$ git pull --rebase README.md master
From github.com:Eider1998/myGitTest
* branch master -> FETCH_HEAD
Current branch master is up to date.
over~~
相關推薦
在Linux中利用git將something傳到GitHub上的方法
從11.3號就開始嘗試將something利用git傳到自己的GitHub上,但是一直不成功,會提示各種各樣的fatal,例如: 一: fatal: remote origin already exists. 解決方式:git remote rm origin
利用Git將項目傳到GitHub上
test bsp repos 出現 github項目 rip 信息 標識 全部 利用Git打開項目所在的目錄 第一步:git init 把目錄變成Git可以管理的倉庫 第二步: git add . 把項目中的文件全部添加到倉庫(暫存區) git add &l
使用git 將專案從GitHub中下載,並上傳專案到GitHub
使用git 將專案從GitHub中下載,並上傳專案到GitHub 進入GitHub官網建立賬戶,並new Repository,倉庫名“Hello-World”,複製地址備用 建立並進入指定的資料夾,比如E:\study\git_study 右鍵-->Git
git-將原生代碼上傳github步驟(附程式碼)
git下載地址:https://git-scm.com/downloads 使用git時是有兩個倉庫的(repertory),本地一個倉庫,用於存放本地需要上傳的程式碼和一些配置資訊。github上一個倉庫,用於在網路端儲存你的程式碼。 下面是原理圖: 圖片來源於:http://www
如何使用Git將原生代碼上傳到github上【圖文】
二、在想要上傳的資料夾右鍵點選會有git bash here點擊出現如圖所示 三、通過命令git init把這個資料夾變成Git可管理的倉庫。 四、通過git add index.html(只新增一個)把專案新增到倉庫(或git add .把該目錄下的所有
網絡傳輸中利用fastjson將復雜嵌套數據類型Json格式轉換(GeoJsonPolygon)
bsp ejs style post 數據表 strong 註意 ets beans 如果一個對象太復雜了,那麽在網絡傳輸鍵的JSON格式數據轉換容易出問題。 比如下面一個類Area.java import lombok.AllArgsConstructor; impor
在pom.xml中使用distributionManagement將項目打包上傳到nexus私服
build 指定 mage 項目打包 admin hold set str eight 本文介紹 如何在pom.xml中使用distributionManagement將項目打包上傳到nexus私服1、pom.xml文件添加distributionManagement節點
linux中利用docker和docker-compose搭建lnmp環境詳解 10分鐘快速完成
本文主要包括部分 注意事項 重要資訊提示 快速執行安裝的純命令 相關介紹 配置檔案,參考地址 1.要求說明: linux, 安裝了docker和docker compose 特別注意: 本文中提及的密碼與本文的配置檔案可能不一致(與新詳
Pycharm中使用Git提交程式碼到Github或碼雲遠端倉庫詳解
說明: 檔名紅色, 表示在工作區 檔名綠色, 表示在暫存區 檔名藍色, 表示檔案有修改,位於暫存區 檔名無顏色,表示位於本地倉庫區或已經提交到遠端倉庫區 檔名為紅色,需要手動執行git add .,
linux中利用shell指令碼條件執行linux命令
linux中利用shell指令碼條件執行命令 在linux環境中,我們總會有一些命令需要經常用,例如經常跳轉到某些目錄下或者執行某些命令,輸入一連串的命令是很煩的,此時我們可以預先寫一些指令碼然後根據我們的選擇自動執行命令,那豈不是完美,本指令碼就是為此而生的(以跳轉不
Xcode中利用git原始碼版本控制
git是一個版本控制系統,可以通過命令列來呼叫,也有專門的桌面軟體;這裡主要介紹在Xcode中如何利用git來進行版本的控制。 一、建立git源 從Xcode5開始引入了使用git的一些新特性,將g
ArcGIS中利用ArcMap將地理座標系轉換成投影座標系(從WKID=4326到WKID=102100)
對於非地理專業的開發人員,對與這些生澀的概念,我們不一定都要了解,但是我們要理解,凡是以經緯度為單位的都是地理座標系,因為它歸根結底是一個橢球體,只不過各個國家為了反映該國家所在區
[使用教程] 在linux中使用git
如果需要建立新的倉庫,請參考配置git並建立新的倉庫。按照教程安裝有三個小問題: 1.1 在測試ssh的時候,顯示Host Key Verification Failed。網上的教程說刪除~/.ssh/known_hosts檔案即可,但是我的資料夾裡只有id_rsa和id_rs
Git將本地的倉庫上傳至碼雲
需要條件: 1)碼雲上面有和本地名字相同的倉庫 2)碼雲上面的倉庫的資料夾內為空 1.建立一個倉庫 $ mkdir learngit $ cd learngit 2.初始化一個Git倉庫,使用git init命令。會生成一個.git檔案,加入版本控制 $ git init
sql server之在儲存過程中利用OpenJson將Json字串轉化為表格
在Sql server2016的版本後,資料庫增加了對Json格式的支援,詳細資訊可以參考微軟官方文件連結 應用背景 線上訂餐系統中,購物車的內容儲存在瀏覽器快取中,所以資料庫關於訂單的設計是訂單表(訂單ID,送貨地址,使用者ID,,,,,),訂單明細表(訂
Java中利用陣列將輸入string型別的數值轉化為int型
本小白在程式設計中做過一道題:從控制檯獲取一行數字,將其中各個數字相乘。 首先本小白想到的是利用integer.parseInt(string s);將字串直接轉換為int型。但發現當輸入一個20位的數時,則會丟擲錯誤。 後來就像利用陣列來存取數字,以為陣列的長度可以根據字串的長度開
Linux中利用crontab建立計劃任務
在linux中啟動crontab服務: /etc/init.d/crond start crontab的命令格式 crontab -l 顯示當前的crontab 檔案(預設編寫的crontab檔案會儲存在 (/var/spool/cron/使用者名稱 例如: /
linux中利用shell指令碼條件執行命令
在linux環境中,我們總會有一些命令需要經常用,例如經常跳轉到某些目錄下或者執行某些命令,輸入一連串的命令是很煩的,此時我們可以預先寫一些指令碼然後根據我們的選擇自動執行命令,那豈不是完美,本指令碼就是為此而生的(以跳轉不同的目錄舉例,當然也可以執行其他命令,
Linux中利用logrotate來對log檔案進行轉儲
使用logrotate對日誌檔案轉儲,按時或者按大小。 logrotate簡介 NAME logrotate - rotates, compresses, and mails system logs SYNOPSIS
解決linux中使用git,ssh每次都要輸入密碼
想一想不對勁啊,我使用的是ssh的方式clone的程式碼,而且在clone之前還生成並且上傳了公鑰,還把公鑰填入git的公鑰庫裡面了,怎麼 還要我輸入密碼?? 仔細研究後,發現了問題所在,原來是在生產公鑰的時候, 執行命令 ssh-keygen -t