简体   繁体   中英

Rookie Q: How do I push empty folders to my BitBucket git repo

I have created a local framework for a software project.

It contains empty folders because well... I haven't begun development.

I tried committing/pushing to my BitBucket repo and it only pushed the folders that had files in them.

How do push empty directories? I've heard you need a.gitkeep or "."hidden files in general. How do I even create a hidden file like this?

A solution that doesnt invlove hidden files would be nice, thanks in advance.

Add blank files in each empty folders, and then try to push it.

I think, folder-name is treated as Path only not as a file which could be pushed.

In Windows:

A way to make a directory stay empty is to create a .gitignore file inside that directory that contains the following:

# Ignore everything in this directory
*
# Except this file
!.gitignore

How do you create it? Open up notepad paste the above into the document and then do a save as, then in the drop down where it shows save as file type select the All files ( . ), as the name of the file type: .gitignore - then save.

On Linux or Mac:

 $ mkdir tmp
 $ touch tmp/.gitignore
 $ git add tmp
 $ echo '# Ignore everything in this directory' > tmp/.gitignore
 $ echo '*' >> tmp/.gitignore
 $ echo '# Except this file' >> tmp/.gitignore
 $ echo '!.gitignore' >> tmp/.gitignore
 $ git commit -m 'Empty directory' tmp

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM