Version Control and Strapi

System Information
  • Strapi Version: Don’t know, is not my pc.
  • Operating System: Don’t know, is not my pc.
  • Database: Don’t know, is not my pc.
  • Node Version: Don’t know, is not my pc.
  • NPM Version: Don’t know, is not my pc.
  • Yarn Version: Don’t know, is not my pc.

A good question on a stack overflow, that remains unresponded.
git - Version Control And Strapi - Stack Overflow

I mean it comes with gitignore which exlucdes most things that should not be there.
So out of the box,

  • git init
  • git remote add origin XYZ
  • git add .
  • git commit -m "init commit
  • git push

As simple as that. Out of the box source control. :slightly_smiling_face:
Of course if you start add other things to it you can build your gitignore around that.

Thanks @Eventyret .
I have just tried that:
1 - Created a new strapi project
2 - Created the credentials: email: test@test.com | pass: Pass1234
3 - Added a single type called “homeage”, and added an entry
4 - Added this project to a repo which you can clone.
5 - cloned the site in another computer
6 - did npm install
7 - then did npm run strapi develop
8 - got an error, and Strapi did not start

Building your admin UI with development configuration...
Admin UI built successfully
[2022-09-07 04:59:29.602] debug: ⛔️ Server wasn't able to start properly.
[2022-09-07 04:59:29.603] error: Middleware "strapi::session": App keys are required. Please set app.keys in config/server.js (ex: keys: ['myKeyA', 'myKeyB'])
Error: Middleware "strapi::session": App keys are required. Please set app.keys in config/server.js (ex: keys: ['myKeyA', 'myKeyB'])
    at instantiateMiddleware (/Users/bruno/Documents/GitHub/my-strapi/node_modules/@strapi/strapi/lib/services/server/middleware.js:12:11)
    at resolveMiddlewares (/Users/bruno/Documents/GitHub/my-strapi/node_modules/@strapi/strapi/lib/services/server/middleware.js:56:18)
    at registerApplicationMiddlewares (/Users/bruno/Documents/GitHub/my-strapi/node_modules/@strapi/strapi/lib/services/server/register-middlewares.js:66:29)
    at async Object.initMiddlewares (/Users/bruno/Documents/GitHub/my-strapi/node_modules/@strapi/strapi/lib/services/server/index.js:99:7)
    at async Strapi.bootstrap (/Users/bruno/Documents/GitHub/my-strapi/node_modules/@strapi/strapi/lib/Strapi.js:445:5)
    at async Strapi.load (/Users/bruno/Documents/GitHub/my-strapi/node_modules/@strapi/strapi/lib/Strapi.js:457:5)
    at async Strapi.start (/Users/bruno/Documents/GitHub/my-strapi/node_modules/@strapi/strapi/lib/Strapi.js:198:9)

Not sure what this has to do with the question you posted, but you need to rename .env.example to .env
Else it doesn’t have any environmental variables.
You should for best practices create a new set of keys.
Since they are committed, and the example just shows you what it should be in there.

Thanks @Eventyret

My question was about how to take a strapi project (with some data), and make it available for other developer on github, so it can be cloned, started up and keep working on it.

I am having an issue in that process.

I did what you suggested:

  • renamed .env.example to .env
  • Created my user, email and pass.
  • Logged in, and I see the single type definition of my hompage, BUT, I dont see the data that I originaly saved on the first computer. Where is that data?

Might be different what you said was

The data will be in the db.sqlite3 which does not get committed.
You will then need to share it. OR setup a shared SQL database of some sort.

The idea of local development isn’t to share the data but share the code.

Sorry @Eventyret I might have got confused.

Thank you very much for this valuable information.

  • How do I share it?
  • Or how do I setup a shared SQL database?

Really appreciate your help.

Well sharing it is like sending a file.
Though I guess setting up a Shared SQL database would be rent one in the cloud, or use docker on your own machine. Then you can just dump and export the SQL file share it and import it.

Really depends how you want your workflow to be.