如何在myeclipse上使用git(码云)

在合适的位置建立本身版本库!html

什么是版本库呢?版本库又名仓库,英文名repository,你能够简单理解成一个目录,这个目录里面的全部文件均可以被Git管理起来,每一个文件的修改、删除,Git都能跟踪,以便任什么时候刻均可以追踪历史,或者在未来某个时刻能够“还原”。git

 

第一步:建立一个版本库很是简单,首先,选择一个合适的地方,建立一个空目录:bash

第二步:经过git init命令把这个目录变成Git能够管理的仓库dom

 

瞬间Git就把仓库建好了,并且告诉你是一个空的仓库(empty Git repository),细心的读者能够发现当前目录下多了一个.git的目录,这个目录是Git来跟踪管理版本库的,没事千万不要手动修改这个目录里面的文件,否则改乱了,就把Git仓库给破坏了。eclipse

若是你没有看到.git目录,那是由于这个目录默认是隐藏的,用ls -ah命令就能够看见。ssh

 

workspace中建立一个新的hello.txt文本ide

以后把文本 加入到 git的管理中this

git status命令能够列出当前目录全部尚未被git管理的文件和被git管理且被修改但还未提交(git commit)的文件.。spa

 

告诉 git 咱们提交了 文件.net

 

初次运行 Git 前的配置

通常在新的系统上,咱们都须要先配置下本身的 Git 工做环境。配置工做只需一次,之后升级时还会沿用如今的配置。固然,若是须要,你随时能够用相同的命令修改已有的配置。

用户信息

第一个要配置的是你我的的用户名称和电子邮件地址。这两条配置很重要,每次 Git 提交时都会引用这两条信息,说明是谁提交了更新,因此会随更新内容一块儿被永久归入历史记录:

 

 

由于上面clone的时候 是使用的https协议  因此 每次提交的时候都会提示 输入用户名和密码!

i  o  a  均可以进入编辑状态

编辑中   :切换到 底行模式!   以后 wq!  保存退出 便可!

从新 启动 Git Bash便可!

若是第一次克隆失败   是由于 没有在本身的git上配置sshkey!

继续下面的操做

打开文件,复制 内容

文件夹下面会多一个

若是是把本地的仓库发布到git上,会遇到下面的问题

执行下列代码会解决问题

Myeclipse安装egit插件

打开  建立一个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 "you@example.com"

  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 <С▒▒▒▒@admin.(none)>) not allowed

 

小豆腐@admin MINGW64 /e/workGit (master)

$ git config --global user.email "501804292@qq.com"

 

小豆腐@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

user.email=501804292@qq.com

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 "501804292@qq.com"

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 "501804292@qq.com"

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 501804292@qq.com

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)

$

相关文章
相关标签/搜索