如何在myeclipse上使用git(碼雲)
在合適的位置創建自己版本庫!
什麽是版本庫呢?版本庫又名倉庫,英文名repository,你可以簡單理解成一個目錄,這個目錄裏面的所有文件都可以被Git管理起來,每個文件的修改、刪除,Git都能跟蹤,以便任何時刻都可以追蹤歷史,或者在將來某個時刻可以“還原”。
第一步:創建一個版本庫非常簡單,首先,選擇一個合適的地方,創建一個空目錄:
第二步:通過git init命令把這個目錄變成Git可以管理的倉庫
瞬間Git就把倉庫建好了,而且告訴你是一個空的倉庫(empty Git repository),細心的讀者可以發現當前目錄下多了一個.git的目錄,這個目錄是Git來跟蹤管理版本庫的,沒事千萬不要手動修改這個目錄裏面的文件,不然改亂了,就把Git倉庫給破壞了。
如果你沒有看到.git目錄,那是因為這個目錄默認是隱藏的,用ls -ah命令就可以看見。
在workspace中創建一個新的hello.txt文本
之後把文本 加入到 git的管理中
git status命令可以列出當前目錄所有還沒有被git管理的文件和被git管理且被修改但還未提交(git commit)的文件.。
告訴 git 我們提交了 文件
初次運行 Git 前的配置
一般在新的系統上,我們都需要先配置下自己的 Git 工作環境。配置工作只需一次,以後升級時還會沿用現在的配置。當然,如果需要,你隨時可以用相同的命令修改已有的配置。
用戶信息
第一個要配置的是你個人的用戶名稱和電子郵件地址。這兩條配置很重要,每次
因為上面clone的時候 是使用的https協議 所以 每次提交的時候都會提示 輸入用戶名和密碼!
按 i o a 都可以進入編輯狀態
編輯中 :切換到 底行模式! 之後 :wq! 保存退出 即可!
重新 啟動 Git Bash即可!
如果第一次克隆失敗 是因為 沒有在自己的git上配置sshkey!
繼續下面的操作
打開文件,復制 內容
文件夾下面會多一個
如果是把本地的倉庫發布到git上,會遇到下面的問題
執行下列代碼會解決問題
Myeclipse安裝
打開 創建一個git文件夾
把下載的egit壓縮文件解壓到git文件夾下 即可!
然後重啟myeclipse
解決辦法
返回上一步 選擇 Force Update
小豆腐@admin MINGW64 /e/workGit
$ git init
Initialized empty Git repository in E:/workGit/.git/
小豆腐@admin MINGW64 /e/workGit (master)
$ pwd
/e/workGit
小豆腐@admin MINGW64 /e/workGit (master)
$ ls
小豆腐@admin MINGW64 /e/workGit (master)
$ ls -a
./ ../ .git/
小豆腐@admin MINGW64 /e/workGit (master)
$ ls
hello.txt
小豆腐@admin MINGW64 /e/workGit (master)
$ gid add hello.txt
bash: gid: command not found
小豆腐@admin MINGW64 /e/workGit (master)
$ git add hello.txt
小豆腐@admin MINGW64 /e/workGit (master)
$ git status
On branch master
Initial commit
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: hello.txt
小豆腐@admin MINGW64 /e/workGit (master)
$ git commit -m"我剛剛提交了一個hello.txt文件";
*** Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
to set your account‘s default identity.
Omit --global to set the identity only in this repository.
fatal: empty ident name (for <С[email protected](none)>) not allowed
小豆腐@admin MINGW64 /e/workGit (master)
$ git config --global user.email "[email protected]"
小豆腐@admin MINGW64 /e/workGit (master)
$ git config --global user.name "XiaoDouFu"
小豆腐@admin MINGW64 /e/workGit (master)
$ git commit -m"我剛剛提交了一個hello.txt文件";
[master (root-commit) 623dd73] 我剛剛提交了一個hello.txt文件
1 file changed, 1 insertion(+)
create mode 100644 hello.txt
小豆腐@admin MINGW64 /e/workGit (master)
$ git config --list
core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
http.sslcainfo=E:/myGit/mingw64/ssl/certs/ca-bundle.crt
diff.astextplain.textconv=astextplain
rebase.autosquash=true
[email protected]
user.name=XiaoDouFu
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
core.hidedotfiles=dotGitOnly
小豆腐@admin MINGW64 /e/workGit (master)
$ git clone https://git.oschina.net/jpwy999/test.git
Cloning into ‘test‘...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
Checking connectivity... done.
小豆腐@admin MINGW64 /e/workGit (master)
$ cd test
小豆腐@admin MINGW64 /e/workGit/test (master)
$ git add hello.txt
小豆腐@admin MINGW64 /e/workGit/test (master)
$ git commit -m"從我本地上第一次上傳"
[master 8727f9e] 從我本地上第一次上傳
1 file changed, 1 insertion(+)
create mode 100644 hello.txt
小豆腐@admin MINGW64 /e/workGit/test (master)
$ git pull --rebase origin master
From https://git.oschina.net/jpwy999/test
* branch master -> FETCH_HEAD
Current branch master is up to date.
小豆腐@admin MINGW64 /e/workGit/test (master)
$ ssh-keygen -t rsa -c "[email protected]"
Too many arguments.
usage: ssh-keygen [-q] [-b bits] [-t dsa | ecdsa | ed25519 | rsa | rsa1]
[-N new_passphrase] [-C comment] [-f output_keyfile]
ssh-keygen -p [-P old_passphrase] [-N new_passphrase] [-f keyfile]
ssh-keygen -i [-m key_format] [-f input_keyfile]
ssh-keygen -e [-m key_format] [-f input_keyfile]
ssh-keygen -y [-f input_keyfile]
ssh-keygen -c [-P passphrase] [-C comment] [-f keyfile]
ssh-keygen -l [-v] [-E fingerprint_hash] [-f input_keyfile]
ssh-keygen -B [-f input_keyfile]
ssh-keygen -D pkcs11
ssh-keygen -F hostname [-f known_hosts_file] [-l]
ssh-keygen -H [-f known_hosts_file]
ssh-keygen -R hostname [-f known_hosts_file]
ssh-keygen -r hostname [-f input_keyfile] [-g]
ssh-keygen -G output_file [-v] [-b bits] [-M memory] [-S start_point]
ssh-keygen -T output_file -f input_file [-v] [-a rounds] [-J num_lines]
[-j start_line] [-K checkpt] [-W generator]
ssh-keygen -s ca_key -I certificate_identity [-h] [-n principals]
[-O option] [-V validity_interval] [-z serial_number] file ...
ssh-keygen -L [-f input_keyfile]
ssh-keygen -A
ssh-keygen -k -f krl_file [-u] [-s ca_public] [-z version_number]
file ...
ssh-keygen -Q -f krl_file file ...
小豆腐@admin MINGW64 /e/workGit/test (master)
$ ssh-keygen -t rsa -C "[email protected]"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/小豆腐/.ssh/id_rsa):
Created directory ‘/c/Users/小豆腐/.ssh‘.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/小豆腐/.ssh/id_rsa.
Your public key has been saved in /c/Users/小豆腐/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:ys8ogLtlMT6ea8H9k5C8MvQxdOu57oi+eyVVJIFkkHg [email protected]
The key‘s randomart image is:
+---[RSA 2048]----+
| ..+o.oo. |
|. E.. .. |
| . . |
| . o |
| oo+ + .S |
|..=oO.o. |
| o=+ Xoo |
|.+++=.*+ |
|.+OB.+=oo |
+----[SHA256]-----+
小豆腐@admin MINGW64 /e/workGit/test (master)
$ git pull --rebase origin master
From https://git.oschina.net/jpwy999/test
* branch master -> FETCH_HEAD
Current branch master is up to date.
小豆腐@admin MINGW64 /e/workGit/test (master)
$ git push origin master
fatal: Authentication failed for ‘https://git.oschina.net/jpwy999/test.git/‘
小豆腐@admin MINGW64 /e/workGit/test (master)
$ git push origin master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 323 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://git.oschina.net/jpwy999/test.git
4f99553..8727f9e master -> master
小豆腐@admin MINGW64 /e/workGit/test (master)
$ git add hello.txt
小豆腐@admin MINGW64 /e/workGit/test (master)
$ git commit -m"我上傳我喜歡"
[master a1d6641] 我上傳我喜歡
1 file changed, 1 insertion(+), 1 deletion(-)
小豆腐@admin MINGW64 /e/workGit/test (master)
$ git push origin master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 313 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://git.oschina.net/jpwy999/test.git
8727f9e..a1d6641 master -> master
小豆腐@admin MINGW64 /e/workGit/test (master)
$
如何在myeclipse上使用git(碼雲)