1. 程式人生 > >git在本地建立的倉庫無法提交到遠端倉庫解決辦法

git在本地建立的倉庫無法提交到遠端倉庫解決辦法

$ cd ..
Administrator@CZ-20151218KCNS MINGW64 /e/gitdir
$ mkdir liqun
Administrator@CZ-20151218KCNS MINGW64 /e/gitdir
$ cd liqun
Administrator@CZ-20151218KCNS MINGW64 /e/gitdir/liqun
$ touch map1.java
Administrator@CZ-20151218KCNS MINGW64 /e/gitdir/liqun
$ vi map
Administrator@CZ-20151218KCNS MINGW64
/e/gitdir/liqun
$ LS
map map1.java
Administrator@CZ-20151218KCNS MINGW64 /e/gitdir/liqun
$ git status
fatal: Not a git repository (or any of the parent directories): .git
Administrator@CZ-20151218KCNS MINGW64 /e/gitdir/liqun
$ git init
Initialized empty Git repository in E:/gitdir/liqun/.git/
Administrator@CZ-20151218KCNS MINGW64 /e/gitdir/liqun (master)
$ git status
On branch master
Initial commit
Untracked files:
(use "git add <file>..." to include in what will be committed)
map
map1.java
nothing added to commit but untracked files present (use "git add" to track)
Administrator@CZ-20151218KCNS MINGW64 /e/gitdir/liqun (master)
$ git add .
warning: LF will be replaced by CRLF in map.
The file will have its original line endings in your working directory.
Administrator@CZ-20151218KCNS MINGW64 /e/gitdir/liqun (master)
$ git status
On branch master
Initial commit
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: map
new file: map1.java
Administrator@CZ-20151218KCNS MINGW64 /e/gitdir/liqun (master)
$ git commit -m "222222"
[master (root-commit) 69f100d] 222222
2 files changed, 1 insertion(+)
create mode 100644 map
create mode 100644 map1.java
Administrator@CZ-20151218KCNS MINGW64 /e/gitdir/liqun (master)
$ git status
On branch master
nothing to commit, working tree clean
Administrator@CZ-20151218KCNS MINGW64 /e/gitdir/liqun (master)
$ git push https://github.com/923794377/wan.git master
To https://github.com/923794377/wan.git
! [rejected] master -> master (fetch first) //push到遠端報錯
error: failed to push some refs to 'https://github.com/923794377/wan.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.
Administrator@CZ-20151218KCNS MINGW64 /e/gitdir/liqun (master)
$ git pull --rebase https://github.com/923794377/wan.git master //用該命令解決
warning: no common commits無法push的問題
remote: Counting objects: 14, done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 14 (delta 0), reused 11 (delta 0), pack-reused 0
Unpacking objects: 100% (14/14), done.
From https://github.com/923794377/wan
* branch master -> FETCH_HEAD
First, rewinding head to replay your work on top of it...
Applying: 222222
Administrator@CZ-20151218KCNS MINGW64 /e/gitdir/liqun (master)
$ git push https://github.com/923794377/wan.git master //push到了遠端倉庫
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 271 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To https://github.com/923794377/wan.git
037b98e..e066d58 master -> master
Administrator@CZ-20151218KCNS MINGW64 /e/gitdir/liqun (master)
$

相關推薦

Git本地init與push到遠端倉庫

1、先進行git配置項檢視與修改初始化 .git刪除:rm -rf .git 檢視資訊:git config --list $ git config --list core.symlinks=false core.autocrlf=true core.fscache=t

git 本地專案推送到遠端倉庫(或者倉庫分支)Window版-01

初始化專案git init 確保安裝了git 在專案根目錄下進入 git命令列 使用git init 命令 使用 git add .命令 使用 git commit

git本地檔案上傳到遠端倉庫時,本地專案與遠成倉庫不是同一個專案的BUG

原文地址 http://blog.csdn.net/lindexi_gd/article/details/52554159 本文講的是把Git在最新2.9.2,合併pull兩個不同的專案,出現的問題如何去解決fatal: refusing to merge unre

Git本地專案推送到遠端倉庫

有時候,我們需要把本地的專案推送到遠端Git倉庫(GitHub或者自己搭建的GitLab)中,可以通過以下幾個步驟來實現: 1、新建遠端倉庫 我們需要在遠端git服務端新建一個Git倉庫來儲存管理本地的專案,有兩種方法,比較簡單,如下: 1. 通過G

Git本地專案配置多個遠端倉庫

目錄 Git一個專案多個遠端倉庫的使用 本地專案配置多個遠端倉庫 現在專案中有一個需求就是一個專案需要推送到多個遠端倉庫。 首先在工作目錄開啟git-bash 然後輸入git rem

git本地建立倉庫無法提交遠端倉庫解決辦法

$ cd .. Administrator@CZ-20151218KCNS MINGW64 /e/gitdir $ mkdir liqun Administrator@

通過Android studio使用git建立本地分支提交遠端倉庫以及如何檢視切換分支

            我們有時候對命令不熟悉的同學例如我,那麼這個AS自帶的這個建立分支功能就對我們必不可少了。 首先我們看下遠端倉庫只有主支master,沒有任何分支的資訊如下圖: 1.首先我們開啟AS,點選右下角的git會彈出選單:如下(右下角預設顯示的事g

如何建立/修改遠端倉庫 + 如何刪除遠端倉庫 + 如何刪除遠端倉庫中的某個檔案或資料夾 + 如何使用git本地倉庫連線到多個遠端倉庫

首先我們來區分一些概念、術語、名詞。不然腦子一鍋粥,總是暈!!!博主對此深有體會!從中學到了沒事要多總結、多歸類! 倉庫有本地倉庫和遠端倉庫之分。倉庫都可以叫做服務端(器)。本地倉庫有:Windows、Linux、MacOS。(指的是執行在不同系統下的本地倉庫)遠端倉庫有:GiuHub(國外)、Gi

本地專案git初始化並提交遠端倉庫

1、先在遠端倉庫(如github)建立專案,為了避免錯誤,不要初始化README, license, 或者gitignore檔案 . 2、開啟Terminal終端 3、切換到你的本地專案目錄 4、初

Git建立本地倉庫並與遠端倉庫建立連線

git init # 初始化本地倉庫 git add ./ # 將檔案新增到待提交區域 git commit -m “提交資訊” # 提交 使用GitHub建立倉庫(new Repos

Git本地倉庫與Github遠端倉庫關聯

1.從遠端克隆一份到本地:git clone Git支援HTTPS和SSH協議,SSH速度更快 $ git clone [email protected]:zkk/xx.git 2.本地庫關聯遠端庫,在本地倉庫目錄執行命令: $ git remote add origin

git本地倉庫 push到遠端倉庫出現錯誤

  ! [rejected] master -> master (fetch first) error: failed to push some refs to hint: Updates were rejected because the

github git 無法讀取遠端倉庫或無許可權

解決方法:重新設定ssh金鑰 ssh-keygen -t rsa -C "http://github.com"//輸入命令後按提示輸入id_rsa.pub的儲存地址 和金鑰密碼 地址預設在~/.ssh資料夾 進入gitub賬號,開啟設定選項 選擇SSH AND GPG keys 選擇NEW

使用git命令將本地專案推送到遠端倉庫

推送前需要在遠端倉庫建立好repository和project,之後會生成專案的url,比如 [email protected]:finger-shoot/shoot-photographe

本地git倉庫push到遠端倉庫的流程

分享一下整個自己建立git遠端倉庫的整個流程以及期間的各種小問題吧: 一、流程: 1、在github上建立repository,右上角點選New repository。 2、詳細資訊介面:填寫名稱和描述(自己隨意),其他項按照預設的即可。 3、填寫完之後點選"create

github提交程式碼無法改變遠端倉庫路徑

最近幾次提交github時,總是提交到Test倉庫,就算用命令 git remote add origin [email protected]:MaYingY/JavaCodes.git 改變它的路徑也不管用,用命令 git remote -v 檢視遠端倉庫,顯示

本地新建git倉庫後與遠端倉庫關聯

 背景說明:如果你想把自己的一個專案開源到,需要新建一個原生代碼倉庫,然後與遠端程式碼庫建立關。不想使用git clone 命令去克隆遠端新建程式碼倉庫,然後再將我們寫好的程式碼copy到克隆下來的資料夾裡,再進行提交。 一、在github上新建一個程式碼倉庫 二、在本地初始化一個git程式碼倉

git 回滾到tag版本 並提交遠端倉庫

      最近工作中遇到了git需要回滾的問題,操作了幾次後發現並不是以前用svn那樣的概念,想用本地的倉庫的程式碼 reset 以後 覆蓋是不可行的,經過查了資料和同事的幫忙,終於是可以了,現在把整個操作步驟記錄下來,FYI!       這裡我的tag是   v.1.

通過Git將程式碼提交遠端倉庫

搞開發經常會用到把程式碼提交到遠端伺服器,之前也是懵懂的。今天來整理了一下。具體操作如下: 1.進入到遠端伺服器 ssh name – 遠端伺服器地址 2.進入以後新建一個空的倉庫 git init –bare name – name 倉庫的名稱 3.

Git用法(把本地倉庫內容放到遠端倉庫

Git:它是分散式版本控制系統,用於專案協同開發版本控制工具,管理程式碼有保障,它是一種倉庫式管理,可以隨時找到之前的操作和修改,。GitLab:是一個用於倉庫管理系統的開源專案。使用Git作為程式碼管理工具,並在此基礎上搭建起來的web服務。是一個程式碼託管平臺使用流程圖: