參考了
https://blog.csdn.net/p10010/article/details/51336332
http://blog.51cto.com/wutengfei/2090253
在其他教程里,都是僅僅添加文件到倉庫下面,可是如果要添加到倉庫里某個文件夾怎么辦?
提交文件
git init
git config --global user.name "wtf" git config --global user.email "wtf@daguan.com" git clone git@gitlab.daguancom:19234/linux/linux_datagrand.git cd linux_datagrand //已經拷下來了,就進入這個你想要加進去東西的文件夾里面 echo "this is a test file." > wtf.txt cat wtf.txt this is a test file ! //復制你的文件或者創建文件在這個文件夾里面 git add xxx //“xxx” 是你要加的文件名 git commit -m "add a file named wtf.txt" //加上注釋 git push -u origin master //提交上去
注意 . 如果創建倉庫的時候某個文件不在本地倉庫 ,在push之前