码云上使用git

一. 登陆码云,注册账号

二. 设置SSH-KEY

生成公匙

git命令: ssh-keygen -t rsa -C “注册码云账号时的邮箱号”
cat ~/.ssh/id_rsa.pub
复制git输出的内容粘贴到码云的SSH keys settings (具体操作如下)

设置公匙

登陆码云,点击头像—settings—SSH keys settings — ssh key名称随意写,下面的空格粘贴上面复制的id_rsa.pub的内容,点击确定即可

三. 在码云上创建项目

四. 把本地的项目上传到码云上命令

设置name和email
git config –global user.name “Your Name”
git config –global user.email “Your Email
码云上使用git_第1张图片

git clone [email protected]/mongodb-test.git
cd mongodb-test/ 进入mongodb-test文件夹(含有.git)
git status 列出分支
git add .
git commit -m ‘first commit’ 提交到本地,将暂存的文件提交到git仓库
git push -u origin master 向远程分支推送数据
此时项目就会上传到码云上了

git命令:

baiyu@FANJC MINGW32 /e/myCode
$ git clone [email protected]:xxxxxx/mongodb-test.git
Cloning into 'mongodb-test'...
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), done.

baiyu@FANJC MINGW32 /e/myCode
$ cd mongodb-test/

baiyu@FANJC MINGW32 /e/myCode/mongodb-test (master)
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.

Untracked files:
  (use "git add ..." to include in what will be committed)

        .gitignore
        .mvn/
        mvnw
        mvnw.cmd
        pom.xml
        src/

nothing added to commit but untracked files present (use "git add" to track)

baiyu@FANJC MINGW32 /e/myCode/mongodb-test (master)
$ git add .
warning: LF will be replaced by CRLF in .gitignore.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in .mvn/wrapper/maven-wrapper.properties.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in mvnw.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in mvnw.cmd.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in pom.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in src/main/java/com/yubai/mongodbtest/MongodbTestApplication.java.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in src/test/java/com/yubai/mongodbtest/MongodbTestApplicationTests.java.
The file will have its original line endings in your working directory.

baiyu@FANJC MINGW32 /e/myCode/mongodb-test (master)
$ git commit -m 'first commit'
[master 6642dad] first commit
 10 files changed, 744 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 .mvn/wrapper/maven-wrapper.jar
 create mode 100644 .mvn/wrapper/maven-wrapper.properties
 create mode 100644 mvnw
 create mode 100644 mvnw.cmd
 create mode 100644 pom.xml
 create mode 100644 src/main/java/com/yubai/mongodbtest/MongoDBTest.java
 create mode 100644 src/main/java/com/yubai/mongodbtest/MongodbTestApplication.java
 create mode 100644 src/main/resources/application.properties
 create mode 100644 src/test/java/com/yubai/mongodbtest/MongodbTestApplicationTests.java

baiyu@FANJC MINGW32 /e/myCode/mongodb-test (master)
$ git push -u origin master
Counting objects: 26, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (17/17), done.
Writing objects: 100% (26/26), 49.18 KiB | 2.73 MiB/s, done.
Total 26 (delta 0), reused 0 (delta 0)
To gitee.com:xxxxxxx/mongodb-test.git
   e3313c1..6642dad  master -> master
Branch master set up to track remote branch master from origin.

参考:[使用码云] (https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/00150154460073692d151e784de4d718c67ce836f72c7c4000)

你可能感兴趣的:(Github,git)