zoukankan      html  css  js  c++  java
  • oschina github使用指南

    我的github仓库开通,https://git.oschina.net/zhjh256。

    1、打开https://git.oschina.net/signup,没有账号的话,则新创建账号。

    2、从https://github.com/git-for-windows/git/releases/download/v2.9.2.windows.1/Git-2.9.2-64-bit.exe下载并安装。

    3、登录git.oschina.net,新建一个项目。

    4、打开git bash,如下:

    5、生成ssh公钥,如下所示:

    $ ssh-keygen -t rsa
    Generating public/private rsa key pair.
    Enter file in which to save the key (/c/Users/zjhua/.ssh/id_rsa):
    Created directory '/c/Users/zjhua/.ssh'.
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /c/Users/zjhua/.ssh/id_rsa.
    Your public key has been saved in /c/Users/zjhua/.ssh/id_rsa.pub.
    The key fingerprint is:
    SHA256:mOt2ztatHjrGTi8jGaekWo6EXtwy5jOl+12zqZFsVcs zjhua@WINDOWS-DV8B1PN
    The key's randomart image is:
    +---[RSA 2048]----+
    | |
    | |
    | . |
    | o o . |
    | o S. E |
    | .. ..+.+ |
    |. .*++.@.+.. |
    |..+B+.Bo@o=.. |
    | .o+*o.X*B+. |
    +----[SHA256]-----+

    6、打开https://git.oschina.net/profile/sshkeys,将id_rsa.pub中的内容拷贝到相应位置,如下:

    7、回到git bash,执行下列命令:

    $ ssh -T git@git.oschina.net
    The authenticity of host 'git.oschina.net (120.55.239.11)' can't be established.
    ECDSA key fingerprint is SHA256:FQGC9Kn/eye1W8icdBgrQp+KkGYoFgbVr17bmjey0Wc.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added 'git.oschina.net,120.55.239.11' (ECDSA) to the list of known hosts.
    Welcome to Git@OSC, HS专用!

     出现红色代表配置成功。

    8、创建git项目的本地副本。

    $ git clone https://git.oschina.net/zhjh256/testgit.git
    Cloning into 'testgit'...
    remote: Counting objects: 5, done.
    remote: Compressing objects: 100% (3/3), done.
    remote: Total 5 (delta 0), reused 0 (delta 0)
    Unpacking objects: 100% (5/5), done.
    Checking connectivity... done.

     -------------增加项目或者修改内容---------------

    9、提交本地修改

    zjhua@WINDOWS-DV8B1PN MINGW64 /d/test/testgit (master)
    $ git add *

    zjhua@WINDOWS-DV8B1PN MINGW64 /d/test/testgit (master)
    $ git status
    On branch master
    Your branch is up-to-date with 'origin/master'.
    Changes to be committed:
    (use "git reset HEAD <file>..." to unstage)

    new file: pom.xml
    new file: src/main/java/com/medsoft/base/utils/JsonUtils.java
    new file: src/main/java/com/medsoft/dlcache/AbstractLocalCacheInitializer.java
    new file: src/main/java/com/medsoft/dlcache/CacheEntry.java
    new file: src/main/java/com/medsoft/dlcache/LocalCacheContainer.java
    new file: src/main/java/com/medsoft/dlcache/LocalCacheService.java
    new file: src/main/java/com/medsoft/dlcache/LocalCacheServiceImpl.java
    new file: src/main/java/com/medsoft/dlcache/LocalCacheUpdateListener.java
    new file: src/main/java/com/medsoft/dlcache/mq/LocalCacheQueueListener.java
    new file: src/main/java/com/medsoft/dlcache/mq/MQProducer.java
    new file: src/main/java/com/medsoft/dlcache/mq/MQProducerImpl.java

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

    .classpath
    .project


    zjhua@WINDOWS-DV8B1PN MINGW64 /d/test/testgit (master)
    $ git commit -m "initial commit"
    [master 01f1e90] initial commit
    11 files changed, 998 insertions(+)
    create mode 100644 pom.xml
    create mode 100644 src/main/java/com/medsoft/base/utils/JsonUtils.java
    create mode 100644 src/main/java/com/medsoft/dlcache/AbstractLocalCacheInitializer.java
    create mode 100644 src/main/java/com/medsoft/dlcache/CacheEntry.java
    create mode 100644 src/main/java/com/medsoft/dlcache/LocalCacheContainer.java
    create mode 100644 src/main/java/com/medsoft/dlcache/LocalCacheService.java
    create mode 100644 src/main/java/com/medsoft/dlcache/LocalCacheServiceImpl.java
    create mode 100644 src/main/java/com/medsoft/dlcache/LocalCacheUpdateListener.java
    create mode 100644 src/main/java/com/medsoft/dlcache/mq/LocalCacheQueueListener.java
    create mode 100644 src/main/java/com/medsoft/dlcache/mq/MQProducer.java
    create mode 100644 src/main/java/com/medsoft/dlcache/mq/MQProducerImpl.java

    zjhua@WINDOWS-DV8B1PN MINGW64 /d/test/testgit (master)
    $ git push sl HEAD
    fatal: 'sl' does not appear to be a git repository
    fatal: Could not read from remote repository.

    Please make sure you have the correct access rights
    and the repository exists.

    zjhua@WINDOWS-DV8B1PN MINGW64 /d/test/testgit (master)
    $ git push
    Username for 'https://git.oschina.net': zhjh256
    Counting objects: 22, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (16/16), done.
    Writing objects: 100% (22/22), 11.52 KiB | 0 bytes/s, done.
    Total 22 (delta 2), reused 0 (delta 0)
    To https://git.oschina.net/zhjh256/testgit.git
    04042d9..01f1e90 master -> master

    10、打开https://git.oschina.net/zhjh256/testgit,看是不是已经提交了。。。

    git默认不上传空的文件夹,如果处于项目结构完整性的考虑需要保留目录结构的话,需要在空文件夹中创建一个占位文件比如.gitkeep。

    其他:

    1、The file will have its original line endings in your working directory。

    不影响提交,忽略即可。

    2、fatal: empty ident name (for <pms@yhd-jqhadoop39.int.yihaodian.com>) not allowed

    解决方法:设置user.email和user.name即可

    admin@DESKTOP-LUSBR0A MINGW64 /D/ldpp/trunk/code/io-spider (master)
    $ git config --global user.name "zhjh256"

    admin@DESKTOP-LUSBR0A MINGW64 /D/ldpp/trunk/code/io-spider (master)
    $ git config --global user.email "zhjh256@163.com"

    admin@DESKTOP-LUSBR0A MINGW64 /D/ldpp/trunk/code/io-spider (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=D:/ProgramFiles/Git/mingw64/ssl/certs/ca-bundle.crt
    diff.astextplain.textconv=astextplain
    rebase.autosquash=true
    credential.helper=manager
    user.name=e
    user.email=zhjh256@163.com
    core.repositoryformatversion=0
    core.filemode=false
    core.bare=false
    core.logallrefupdates=true
    core.symlinks=false
    core.ignorecase=true
    remote.origin.url=https://git.oschina.net/zhjh256/io-spider.git
    remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
    branch.master.remote=origin
    branch.master.merge=refs/heads/master

    3、删除项目

    关于git暂存区,可以参考http://www.cnblogs.com/brothertao/archive/2011/04/01/2002444.html,http://www.cnblogs.com/DreamDrive/p/4155808.html。

  • 相关阅读:
    Java编程的逻辑 (62)
    float示例
    如何避免在短时间内按钮被多次重复点击
    前端(jQuery)(9)-- jQuery菜单
    前端(jQuery)(8)-- jQuery元素遍历
    前端(jQuery)(6)-- jQuery的扩展与noConflict
    前端(jQuery)(5)-- jQuery AJAX异步访问和加载片段
    xampp中tomcat服务器无法启动
    前端(jQuery)(4)-- jQuery隐藏显示与淡入淡出、滑动、回调
    自定义事件总结
  • 原文地址:https://www.cnblogs.com/zhjh256/p/5713420.html
Copyright © 2011-2022 走看看