如何在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 工作环境。配置工作只需一次,以后升级时还会沿用现在的配置。当然,如果需要,你随时可以用相同的命令修改已有的配置。

用户信息

第一个要配置的是你个人的用户名称和电子邮件地址。这两条配置很重要,每次 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 "[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)

$

时间: 2024-08-29 01:43:55

如何在myeclipse上使用git(码云)的相关文章

Myeclipse10.7安装git插件并将Java项目上传到码云(github)

注:本文来源:外匹夫的<Myeclipse10.7安装git插件并将Java项目上传到码云(github)> 一.先说说安装egit插件的步骤(安装egit不成功的原因主要是下载的egit版本不适合当前使用的Myeclipse版本). 通过上网搜索安装eclipse插件主要有以下三种方式: 第一种方式: 对于不同版本的eclipse和myeclipse可能有所不同,主要是有以下两种情况: 1. EGit插件地址:http://download.eclipse.org/egit/updates

eclipse利用git插件将项目上传到码云

1.eclipse--->Help--->install new software--->da - http://kesin.oschina.io/update-site/4.5/ 2.将项目上传到码云 https://www.cnblogs.com/mmzs/p/8607854.html 原文地址:https://www.cnblogs.com/gdf456/p/12402884.html

idea项目上传到码云

从idea托管项目到码云相对其他软件来说是非常简单的,只要第一次下载好git插件,然后托管如下: 1. 2. 3.登陆成功后,默认会将项目所有项全选,托管成功后右下角会显示 4.当以后项目有变化时再如下操作 右键项目-->Git--> commit directory 当然,这只是idea的上传方法,要是使用其他的软件就会有不同的操作,但原理大致相同,都会先新建一个本地的git仓库,然后上传到码云,所以为了实现解耦,即与软件无关,使用git命令行才是最好的选择. 下面是一个学习git的链接 h

将本地项目上传到码云————呱呱二号

将本地的项目上传到码云 1.码云上创建一个项目 testgit (名字随你) 2.本地创建一个文件夹D:/testgit,然后使用git bash 3.cd 到本地文件夹中D:/testgit, 4.使用 git init 命令 ,初始化一个git 本地仓库(项目),会在本地创建一个 .git 的文件夹 5.使用git remote add origin https://gitee.com/你的码云用户名/testgit      //添加远程仓库 6.使用 git pull origin ma

将本地的项目上传到码云

将本地的项目上传到码云(https://www.cnblogs.com/jackson-zhangjiang/p/9759746.html) 1.码云上创建一个项目 bootMybatis (名字随你) 2.本地创建一个文件夹D:/bootMybatis,然后使用git bash 3.cd 到本地文件夹中D:/bootMybatis, 4.使用 git init 命令 ,初始化一个git 本地仓库(项目),会在本地创建一个 .git 的文件夹 5.使用 git remote add origin

eclipse(或者STS)+git+码云的结合使用

在学到BOS_v2.0这个项目时,会教大家使用git,并且会连接在线仓库"码云",把代码提交到"码云"上,这也是工作中团队开发必备技能,那么今天就详细来个教程,说说 eclipse(或者STS)+git+码云的结合使用. 一. 在开源中国上面新建一个空项目到这里也就结束了,一个空项目创建完成. 一. 将本地项目上传到我们新建的项目中去2.1在eclipse中新建一个测试项目2.2 右键team->分享项目.2.3 将项目本身做为仓库,项目下会多一个.Git的文

上传到码云时遇到:Incorrect username or password ( access token )

由于之前上传到 码云时候使用命令:git push -u origin master时出现如下bug Incorrect username or password ( access token ) 时用户名与密码错误,可能是将github的账密误赔给了码云所有导致了这个错误, 只需要在控制面板中做如下更改即可解决问题 解决: 在控制面板中点击用户账号 在点击管理widows凭据 点击修改如下两项,在将其中的账密改为码云上正确的账密即可 原文地址:https://www.cnblogs.com/a

通过idea配置创建node.js项目,并上传至码云。

纠结了一会要不要写这么简单的随笔,善始善终吧.开始之前得先确保你已经安装好node了.可以参考之前一篇教程:Node.js安装教程--windows中通过安装nvmw方式安装管理node .同时要先去码云上注册个帐号吧. 1.打开idea,新建项目: 2.选择Node.js and NPM 3.此处选择已经安装好的node地址: 4.点击finish即可,耐心等待. 5.大功告成: 6.下面开始上传至码云, VCS ---Import into Version Control ----托管项目到

git 码云上关联仓库 克隆代码

把本地代码和远程相关联 初始化用户邮箱:  git config --global user.name 'Your Name' git condig --global user.email '[email protected]' 1,git clone '地址' 重名文件      ----克隆代码 2,git init 初始化仓库 3,生成公钥 $ ssh-keygen -t rsa -C "[email protected]" 一路回车 4,在码云上添加你的公钥 标题是随便写  公