osChina创建git工程

本文详细介绍了如何创建文件夹、克隆项目、管理文件、上传至Git仓库的操作流程,包括获取Git URL、使用Git命令如`git clone`, `git add`, `git commit`等,并展示了将`gitignore`文件保存到项目中并上传到远程仓库的过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >




创建一个空的文件夹。(个人创建在了桌面,名字为gitTest

cd /Users/apple/Desktop/gitTest

把项目工程的git URL得到

WiKideMacBook-Air:gitTest WiKi$ git clone git@git.oschina.net:suwenkang/onlyText.git

WiKideMacBook-Air:gitTest WiKi$ cd onlyText/

WiKideMacBook-Air:onlyText WiKi$ ls -la

终端会出现下面的样子。下列中.git

total 16

drwxr-xr-x   5 WiKi  staff   170 12 10 13:00 .

drwxr-xr-x   3 WiKi  staff   102 12 10 13:00 ..

drwxr-xr-x  13 WiKi  staff   442 12 10 13:00 .git

-rw-r--r--   1 WiKi  staff  1073 12 10 13:00 LICENSE

-rw-r--r--   1 WiKi  staff    11 12 10 13:00 README.md


从https://github.com/github/gitignore 下载下gitignore。然后保存在任何位置、(个人保存在了桌面)


将gitignore保存gitTest文件下,

p /Users/apple/Desktop/gitignore-master/Swift.gitignore .gitignore


WiKideMacBook-Air:onlyText WiKi$ ls -la


我们会发现多出来一个.gitignore文件。

total 24

drwxr-xr-x   6 WiKi  staff   204 12 10 13:06 .

drwxr-xr-x   3 WiKi  staff   102 12 10 13:00 ..

drwxr-xr-x  13 WiKi  staff   442 12 10 13:00 .git

-rwxr-xr-x@  1 WiKi  staff  1319 12 10 13:06 .gitignore

-rw-r--r--   1 WiKi  staff  1073 12 10 13:00 LICENSE

-rw-r--r--   1 WiKi  staff    11 12 10 13:00 README.md


把gitignore保存在git上。

git status

git add .

git status

提交代码,完成git中取消上传个人习惯。

git commit -m "添加gitignore"










评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值