标签:mingw 新建 compress base ESS branch local 查看 git 使用
目录
参考:
https://www.cnblogs.com/simple1368/p/9084077.html
git init --bare 仓库名.git
[git@localhost git]$ git init --bare hugin.git
Initialized empty Git repository in /home/git/git/hugin.git/
[git@localhost git]$ ls
hugin.git
[git@localhost git]$ pwd
/home/git/git
Z17023031@ZHS-W54001050 MINGW64 /e/code/SVN/Hugin/L11RackMonitor/trunk/sourcecode (master)
$ pwd
/e/code/SVN/Hugin/L11RackMonitor/trunk/sourcecode
git init
$ git init
Initialized empty Git repository in E:/code/SVN/Hugin/L11RackMonitor/trunk/sourcecode/.git/
$ ls
hugin/
$ touch .gitignore
$ ls
hugin/
Z17023031@ZHS-W54001050 MINGW64 /e/code/SVN/Hugin/L11RackMonitor/trunk/sourcecode (master)
$ git status
On branch master
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
.gitignore
hugin/
nothing added to commit but untracked files present (use "git add" to track)
Z17023031@ZHS-W54001050 MINGW64 /e/code/SVN/Hugin/L11RackMonitor/trunk/sourcecode (master)
$ git add .
git commit -m ‘提交信息‘
git commit -m 'first commit'
git remote add origin 远程库地址(用户@IP:git仓库目录路径)
$ git remote add origin git@10.41.95.207:/home/git/git/hugin.git
第一次p ush 的时候,加上 -u 参数,
Git 就会把本地的 master 分支和远程的 master 分支进行关联起来, 我们以后的 push 操作就不再需要加上 -u 参数了
$ git push -u origin master
git@10.41.95.207's password:
Enumerating objects: 764, done.
Counting objects: 100% (764/764), done.
Delta compression using up to 8 threads
Compressing objects: 100% (735/735), done.
Writing objects: 100% (764/764), 2.71 MiB | 5.61 MiB/s, done.
Total 764 (delta 80), reused 0 (delta 0)
To 10.41.95.207:/home/git/git/hugin.git
* [new branch] master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.
注意:若远程 git 仓库为空,可直接做这一步
若远程 git 仓库不为空
git pull --rebase origin master
同步了远程之后想看看最新的内容有没有在上面,于是我在 git 远程仓库所在的服务器上的另一个目录进行克隆
[hugin@localhost test1]$ git clone git@127.0.0.1:/home/git/git/hugin.git
Cloning into 'hugin'...
git@127.0.0.1's password:
remote: Counting objects: 764, done.
remote: Compressing objects: 100% (655/655), done.
remote: Total 764 (delta 80), reused 764 (delta 80)
Receiving objects: 100% (764/764), 2.71 MiB | 0 bytes/s, done.
Resolving deltas: 100% (80/80), done.
[hugin@localhost test1]$ ls
hugin
看了一下目录的内容,有成功同步
可以看到远程克隆的时候要输 git 用户密码,用来专门控制克隆权限。
所以一开始就要新建 git 用户专门用于控制远程 code 文件
标签:mingw 新建 compress base ESS branch local 查看 git 使用
原文地址:https://www.cnblogs.com/JanSN/p/11636673.html