기사 디렉토리
1. gitee 소개
gitee
(중국어 이름 : Code Cloud, 원래 이름 Git@OSC
)은 Open Source China에서 시작한 git
코드 호스팅 서비스 입니다 .
국내 접속 GitHub
속도는 상대적으로 느리다. 자신의 코드를 클라우드에 호스팅하고 싶다면 gitee
화웨이의 鸿蒙2.0
소스 코드도 gitee
맨 위에있다.
둘째, git 설치
이를 사용하려면 gitee
먼저 git
도구 를 설치해야합니다 .
git
도구 다운로드 : https://git-scm.com/downloads
설치가 완료되면 명령 줄에서 git --version
볼 수있는 git
버전을 입력 합니다.
오른쪽 클릭 메뉴도 해당 메뉴를 나타냅니다.
셋, gitee에 로그인
먼저 gitee
등록 된 계정으로 로그인합니다.
gitee
공식 웹 사이트 : https://gitee.com/
넷, SSH 공개 키 생성
우리의 로컬 git
창고와 암호화를 gitee
통한 창고 간 전송 SSH
때문에 SSH
공개 키 를 구성해야합니다 .
참고 :
git
도구가 설치되면 다음ssh
명령을 사용할 수 있습니다.
cmd
명령 줄을 열고 명령을 입력합니다.
ssh-keygen -t rsa -C "[email protected]"
참고 : 이것은
[email protected]
생성 된 sshkey의 이름 일 뿐이며 사서함의 특정 이름을 제한하거나 요구하지 않습니다.
완료하려면 프롬프트를 따르십시오.세 번 입력생성합니다 ssh key
.
우리가 생성 한 공개 키 파일의 id_rsa.pub
경로 를 볼 수 있습니다 C:\User\Adminstrator/.ssh/id_rsa.pub
. 디렉토리를 입력하고 텍스트 편집기
로 열어 SSH
다음에서 사용될 공개 키 를 확인합니다 SSH
.
다섯, SSH 공개 키 구성
에서 gitee
웹 사이트를 클릭 设置
클릭 SSH
공공
바로 복사, 입력 공개 키 제목 SSH
상자에 공개 키를 입력하고 확인을 클릭
성공적인 구성을
여섯, 프로젝트 만들기
+
번호 오른쪽 상단 모서리 ,
아래 의 새 창고를 클릭하고 정보 창고를 입력 한 다음 마지막으로 생성을 클릭합니다.
일곱, 창고를 지역에 복제
클릭 克隆/下载
, 클릭 한 다음 SSH
할당, git
링크
다음, 로컬 디렉토리의 빈 공간에 오른쪽 클릭 메뉴를 클릭합니다 Git Bash Here
. 다음과 같이
입력하십시오.git clone 刚刚的git链接
git clone [email protected]:linxinfa/mytest.git
성공하면 복제 된 README
파일 을 로컬 디렉토리에서 볼 수 있습니다 .
8. 로컬 프로젝트를 원격웨어 하우스에 연결
때로는 먼저 프로젝트 파일을 로컬에 저장 한 다음 그 gitee
위에웨어 하우스 를 생성 할 수 있습니다.
이 경우 명령을 로컬 라이브러리에서 사용할 수 있으며 다음과 같이 원격 라이브러리 git remote add
와 gitee
연결할 수 있습니다.
git remote add origin git@gitee.com:linxinfa/mytest.git
git remote add
주어진 명령을 사용하는 경우 :
git remote add origin git@gitee.com:linxinfa/mytest.git
fatal: remote origin already exists.
참고 로컬 라이브러리는 origin
원격 라이브러리 의 이름과 연결되어 있습니다. 이번에 git remote -v
는 원격 라이브러리 정보를 보는 데 사용할 수 있습니다 .
git remote -v
origin git@gitee.com:linxinfa/mytest.git (fetch)
origin git@gitee.com:linxinfa/mytest.git (push)
기존 원격 라이브러리를 삭제할 수 있습니다.
git remote rm origin
원격 라이브러리 다시 연결
git remote add origin git@gitee.com:linxinfa/mytest.git
아홉, 파일 추가
다음과 같이 로컬로 AddFileTest.txt
파일을 추가하고 파일을 추가 합니다.
10. git 명령 실행 및 파일 제출
열기 git
, 실행 git
의 add
, commit
, push
명령, 당신은 원격 저장소에 로컬 파일을 업로드 할 수 있습니다.
참고 : 일반적으로 사용되는 git
명령은 문서 끝 부분을 참조하십시오. 페이지를
새로 고침하면 gitee
로컬 파일이```gitee``에 업로드 된 것을 볼 수 있습니다.
11. 창고 삭제
管理
창고 를 삭제하려면 클릭하고 프롬프트에 따라 비밀번호를 입력하십시오.
일반적으로 사용되는 12 가지 git 명령
일반적으로 사용되는 git
명령
git init #把当前目录变成git可以管理的仓库
git add readme.txt #添加一个文件,也可以添加文件夹
git add -A #添加全部文件
git rm test.txt #删除一个文件,也可以删除文件夹
git commit -a -m "some commit" #提交修改
git status #查看是否还有未提交
git log #查看最近日志
git reset --hard HEAD^ #版本回退一个版本
git reset --hard HEAD^^ #版本回退两个版本
git reset --hard HEAD~100 #版本回退多个版本
git remote add origin +地址 #远程仓库的提交(第一次链接)
git push -u origin master #仓库关联
git push #远程仓库的提交(第二次及之后)
더 많은 git
명령을 입력하여 git --help
볼 수 있습니다.
git --help
usage: git [--version] [--help] [-C <path>] [-c <name>=<value>]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
<command> [<args>]
These are common Git commands used in various situations:
start a working area (see also: git help tutorial)
clone Clone a repository into a new directory
init Create an empty Git repository or reinitialize an existing one
work on the current change (see also: git help everyday)
add Add file contents to the index
mv Move or rename a file, a directory, or a symlink
restore Restore working tree files
rm Remove files from the working tree and from the index
sparse-checkout Initialize and modify the sparse-checkout
examine the history and state (see also: git help revisions)
bisect Use binary search to find the commit that introduced a bug
diff Show changes between commits, commit and working tree, etc
grep Print lines matching a pattern
log Show commit logs
show Show various types of objects
status Show the working tree status
grow, mark and tweak your common history
branch List, create, or delete branches
commit Record changes to the repository
merge Join two or more development histories together
rebase Reapply commits on top of another base tip
reset Reset current HEAD to the specified state
switch Switch branches
tag Create, list, delete or verify a tag object signed with GPG
collaborate (see also: git help workflows)
fetch Download objects and refs from another repository
pull Fetch from and integrate with another repository or a local branch
push Update remote refs along with associated objects
'git help -a' and 'git help -g' list available subcommands and some
concept guides. See 'git help <command>' or 'git help <concept>'
to read about a specific subcommand or concept.
See 'git help git' for an overview of the system.