GitHub基本提交操作

2021-07-31 22:42:44 字數 1434 閱讀 9765

1.在網頁版的github下新建倉庫

然後

git clone (你的倉庫名[email protected]:***/***.git
2.在git bash終端使用 cd 命令切換進clone的目錄

此時可以使用git status看下情況,當然,啥也木有

on branch master

initial commit

nothing to

commit (create/copy files and use "git add"

to track)

3.這裡,初始化一下倉庫

git init
4.然後把資料夾中你要新增的東西,使用

git add ***
5.可以建乙個readme.md,markdown格式的檔案,使用touch命令

touch readme.md
6.將檔案加入暫存區,然後使用git commit,-m後的是提交資訊,是對本次提交的概述

git commit -m "this is a demo,you can say whatever you'd like to say"

不加-m的話,會彈出乙個vi編輯器介面,注意把要說的話在寫進去,去除#即可,否則不生效

提交好了可以通過git log 看下日誌

7.push

到上一步,github上的倉庫還木有被更新,此時需用push命令

git push
done

坑: 如果clone到乙個空倉庫,開始不init的話,後面會提示你

*** please tell me who you are.

run git config --global user.email "[email protected]"

git config --global user.name "your name"

toset your account's default identity.

omit --global

toset the identity only in this repository.

fatal: empty ident name (for

<(null)>) not allowed

這時候可能即使你執行這兩行了,也沒反應。

解決方法是到你這個資料夾的目錄,win的話開啟隱藏的.git資料夾,config這個檔案開啟,加入

[user]

name=yourname

email=youremail

就好了。。。

Github 基本操作

github 基本操作 配置git 首先在本地建立ssh key ssh keygen t rsa c your email youremail.com 後面的your email youremail.com改為你的郵箱,之後會要求確認路徑和輸入密碼,我們這使用預設的一路回車就行。成功的話會在 下生...

github基本操作

一 使用者名稱和郵箱 1.檢視使用者名稱和郵箱 git config user.name git config user.email 2.修改使用者名稱和郵箱 git config global user.name username git config global user.email emai...

github基本操作

1 註冊github賬號 第一步肯定是先去github官網註冊個賬號 2 新建repository 新建repository,例如 python 專門儲存用python編寫的一些指令碼 會得到倉庫位址,git支援兩種協議 https 與 ssh,本文使用 https 方式 3 安裝git客戶端 因為...