How to use Git With Laravel?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I'm pretty new to Git. I'm developing using PHP/Laravel on at least two machines; both Windows 10, let's call them office and home. I want to keep a sync environment on both. So I created an account on BitBucket.
I created my Laravel app using Laragon using the directory: d:laragonwwwproject
I created a clean remote repo in BitBucket and configured for use on the office PC, inside the project directory:
git init
git remote add origin https://...
git add .
git commit master
git push -u origin master
It copies some of the files to the remote repository. I understand this is because of the .gitignore file, and that's okay.
Now the thing is if I go to my home PC and do a:
git clone http://...
It will only get the non-ignored files. My question is, how do I have to configure the second development environment?
I tried to create a new app at the home's c:laragonwwwproject and then try to clone in this directory, but of course it says the directory is not empty, so does nothing.
Do I have to delete the .gitignore file the first time, so it syncs everything?
php git laravel laragon
add a comment |
I'm pretty new to Git. I'm developing using PHP/Laravel on at least two machines; both Windows 10, let's call them office and home. I want to keep a sync environment on both. So I created an account on BitBucket.
I created my Laravel app using Laragon using the directory: d:laragonwwwproject
I created a clean remote repo in BitBucket and configured for use on the office PC, inside the project directory:
git init
git remote add origin https://...
git add .
git commit master
git push -u origin master
It copies some of the files to the remote repository. I understand this is because of the .gitignore file, and that's okay.
Now the thing is if I go to my home PC and do a:
git clone http://...
It will only get the non-ignored files. My question is, how do I have to configure the second development environment?
I tried to create a new app at the home's c:laragonwwwproject and then try to clone in this directory, but of course it says the directory is not empty, so does nothing.
Do I have to delete the .gitignore file the first time, so it syncs everything?
php git laravel laragon
1
When you clone a Laravel repo, you need to runcomposer installto create your/vendorfolder (which is in.gitignore). Beside that, you generally just need to copy.env.exampleto.env, configure any keys in that file to what you need, adjust some permissions on folders (depending on your setup) and then you're good to go. Essentially, no, you don't want to delete.gitignore; it's there for a reason.
– Tim Lewis
Jan 3 at 21:40
You can see sitepoint.com/deploy-website-using-laravel-git
– Nicolás Alarcón Rapela
Jan 3 at 21:42
I was reading precisely that sitepoint article, but it looks to do something much more complex than what I need right now
– luisfer
Jan 3 at 21:50
add a comment |
I'm pretty new to Git. I'm developing using PHP/Laravel on at least two machines; both Windows 10, let's call them office and home. I want to keep a sync environment on both. So I created an account on BitBucket.
I created my Laravel app using Laragon using the directory: d:laragonwwwproject
I created a clean remote repo in BitBucket and configured for use on the office PC, inside the project directory:
git init
git remote add origin https://...
git add .
git commit master
git push -u origin master
It copies some of the files to the remote repository. I understand this is because of the .gitignore file, and that's okay.
Now the thing is if I go to my home PC and do a:
git clone http://...
It will only get the non-ignored files. My question is, how do I have to configure the second development environment?
I tried to create a new app at the home's c:laragonwwwproject and then try to clone in this directory, but of course it says the directory is not empty, so does nothing.
Do I have to delete the .gitignore file the first time, so it syncs everything?
php git laravel laragon
I'm pretty new to Git. I'm developing using PHP/Laravel on at least two machines; both Windows 10, let's call them office and home. I want to keep a sync environment on both. So I created an account on BitBucket.
I created my Laravel app using Laragon using the directory: d:laragonwwwproject
I created a clean remote repo in BitBucket and configured for use on the office PC, inside the project directory:
git init
git remote add origin https://...
git add .
git commit master
git push -u origin master
It copies some of the files to the remote repository. I understand this is because of the .gitignore file, and that's okay.
Now the thing is if I go to my home PC and do a:
git clone http://...
It will only get the non-ignored files. My question is, how do I have to configure the second development environment?
I tried to create a new app at the home's c:laragonwwwproject and then try to clone in this directory, but of course it says the directory is not empty, so does nothing.
Do I have to delete the .gitignore file the first time, so it syncs everything?
php git laravel laragon
php git laravel laragon
edited Jan 4 at 4:08
Karl Hill
3,44132446
3,44132446
asked Jan 3 at 21:35
luisferluisfer
382419
382419
1
When you clone a Laravel repo, you need to runcomposer installto create your/vendorfolder (which is in.gitignore). Beside that, you generally just need to copy.env.exampleto.env, configure any keys in that file to what you need, adjust some permissions on folders (depending on your setup) and then you're good to go. Essentially, no, you don't want to delete.gitignore; it's there for a reason.
– Tim Lewis
Jan 3 at 21:40
You can see sitepoint.com/deploy-website-using-laravel-git
– Nicolás Alarcón Rapela
Jan 3 at 21:42
I was reading precisely that sitepoint article, but it looks to do something much more complex than what I need right now
– luisfer
Jan 3 at 21:50
add a comment |
1
When you clone a Laravel repo, you need to runcomposer installto create your/vendorfolder (which is in.gitignore). Beside that, you generally just need to copy.env.exampleto.env, configure any keys in that file to what you need, adjust some permissions on folders (depending on your setup) and then you're good to go. Essentially, no, you don't want to delete.gitignore; it's there for a reason.
– Tim Lewis
Jan 3 at 21:40
You can see sitepoint.com/deploy-website-using-laravel-git
– Nicolás Alarcón Rapela
Jan 3 at 21:42
I was reading precisely that sitepoint article, but it looks to do something much more complex than what I need right now
– luisfer
Jan 3 at 21:50
1
1
When you clone a Laravel repo, you need to run
composer install to create your /vendor folder (which is in .gitignore). Beside that, you generally just need to copy .env.example to .env, configure any keys in that file to what you need, adjust some permissions on folders (depending on your setup) and then you're good to go. Essentially, no, you don't want to delete .gitignore; it's there for a reason.– Tim Lewis
Jan 3 at 21:40
When you clone a Laravel repo, you need to run
composer install to create your /vendor folder (which is in .gitignore). Beside that, you generally just need to copy .env.example to .env, configure any keys in that file to what you need, adjust some permissions on folders (depending on your setup) and then you're good to go. Essentially, no, you don't want to delete .gitignore; it's there for a reason.– Tim Lewis
Jan 3 at 21:40
You can see sitepoint.com/deploy-website-using-laravel-git
– Nicolás Alarcón Rapela
Jan 3 at 21:42
You can see sitepoint.com/deploy-website-using-laravel-git
– Nicolás Alarcón Rapela
Jan 3 at 21:42
I was reading precisely that sitepoint article, but it looks to do something much more complex than what I need right now
– luisfer
Jan 3 at 21:50
I was reading precisely that sitepoint article, but it looks to do something much more complex than what I need right now
– luisfer
Jan 3 at 21:50
add a comment |
1 Answer
1
active
oldest
votes
I'm assuming that you already have your second machine with the basic set up (php, composer, laravel, local server, node and so on..)
First of all you need to install your composer dependencies (listed in composer.json), to accomplish this run:
composer install
The .gitignore will only ignore.. well.. the desired ignored files, such as: node_modules and .env for example. To solve this, install your dependencies (listed in your package.json, that is not ignored by default) in your second machine using npm or yarn:
npm install
// or
yarn install
In the case of your .env file, I suggest you to clone the .env.example (creating the desired .env) and set your keys in every machine, because any of them can have a different setup.
Of course, your Laravel encryption key needs to be generated, so run:
php artisan key:generate
Finally, migrate your database (and populate it, in case you set up seeders) like this:
php artisan migrate --seed
// notice the '--seed' flag is used when you want to run your seeders
OK, I'll try this at home, sounds easy! Thanks a lot!
– luisfer
Jan 3 at 21:48
It worked perfectly! Thanks a lot!
– luisfer
Jan 4 at 4:33
@luisfer glad to help.
– HCK
Jan 4 at 4:46
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54030118%2fhow-to-use-git-with-laravel%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I'm assuming that you already have your second machine with the basic set up (php, composer, laravel, local server, node and so on..)
First of all you need to install your composer dependencies (listed in composer.json), to accomplish this run:
composer install
The .gitignore will only ignore.. well.. the desired ignored files, such as: node_modules and .env for example. To solve this, install your dependencies (listed in your package.json, that is not ignored by default) in your second machine using npm or yarn:
npm install
// or
yarn install
In the case of your .env file, I suggest you to clone the .env.example (creating the desired .env) and set your keys in every machine, because any of them can have a different setup.
Of course, your Laravel encryption key needs to be generated, so run:
php artisan key:generate
Finally, migrate your database (and populate it, in case you set up seeders) like this:
php artisan migrate --seed
// notice the '--seed' flag is used when you want to run your seeders
OK, I'll try this at home, sounds easy! Thanks a lot!
– luisfer
Jan 3 at 21:48
It worked perfectly! Thanks a lot!
– luisfer
Jan 4 at 4:33
@luisfer glad to help.
– HCK
Jan 4 at 4:46
add a comment |
I'm assuming that you already have your second machine with the basic set up (php, composer, laravel, local server, node and so on..)
First of all you need to install your composer dependencies (listed in composer.json), to accomplish this run:
composer install
The .gitignore will only ignore.. well.. the desired ignored files, such as: node_modules and .env for example. To solve this, install your dependencies (listed in your package.json, that is not ignored by default) in your second machine using npm or yarn:
npm install
// or
yarn install
In the case of your .env file, I suggest you to clone the .env.example (creating the desired .env) and set your keys in every machine, because any of them can have a different setup.
Of course, your Laravel encryption key needs to be generated, so run:
php artisan key:generate
Finally, migrate your database (and populate it, in case you set up seeders) like this:
php artisan migrate --seed
// notice the '--seed' flag is used when you want to run your seeders
OK, I'll try this at home, sounds easy! Thanks a lot!
– luisfer
Jan 3 at 21:48
It worked perfectly! Thanks a lot!
– luisfer
Jan 4 at 4:33
@luisfer glad to help.
– HCK
Jan 4 at 4:46
add a comment |
I'm assuming that you already have your second machine with the basic set up (php, composer, laravel, local server, node and so on..)
First of all you need to install your composer dependencies (listed in composer.json), to accomplish this run:
composer install
The .gitignore will only ignore.. well.. the desired ignored files, such as: node_modules and .env for example. To solve this, install your dependencies (listed in your package.json, that is not ignored by default) in your second machine using npm or yarn:
npm install
// or
yarn install
In the case of your .env file, I suggest you to clone the .env.example (creating the desired .env) and set your keys in every machine, because any of them can have a different setup.
Of course, your Laravel encryption key needs to be generated, so run:
php artisan key:generate
Finally, migrate your database (and populate it, in case you set up seeders) like this:
php artisan migrate --seed
// notice the '--seed' flag is used when you want to run your seeders
I'm assuming that you already have your second machine with the basic set up (php, composer, laravel, local server, node and so on..)
First of all you need to install your composer dependencies (listed in composer.json), to accomplish this run:
composer install
The .gitignore will only ignore.. well.. the desired ignored files, such as: node_modules and .env for example. To solve this, install your dependencies (listed in your package.json, that is not ignored by default) in your second machine using npm or yarn:
npm install
// or
yarn install
In the case of your .env file, I suggest you to clone the .env.example (creating the desired .env) and set your keys in every machine, because any of them can have a different setup.
Of course, your Laravel encryption key needs to be generated, so run:
php artisan key:generate
Finally, migrate your database (and populate it, in case you set up seeders) like this:
php artisan migrate --seed
// notice the '--seed' flag is used when you want to run your seeders
edited Jan 4 at 4:46
answered Jan 3 at 21:40
HCKHCK
3,80011338
3,80011338
OK, I'll try this at home, sounds easy! Thanks a lot!
– luisfer
Jan 3 at 21:48
It worked perfectly! Thanks a lot!
– luisfer
Jan 4 at 4:33
@luisfer glad to help.
– HCK
Jan 4 at 4:46
add a comment |
OK, I'll try this at home, sounds easy! Thanks a lot!
– luisfer
Jan 3 at 21:48
It worked perfectly! Thanks a lot!
– luisfer
Jan 4 at 4:33
@luisfer glad to help.
– HCK
Jan 4 at 4:46
OK, I'll try this at home, sounds easy! Thanks a lot!
– luisfer
Jan 3 at 21:48
OK, I'll try this at home, sounds easy! Thanks a lot!
– luisfer
Jan 3 at 21:48
It worked perfectly! Thanks a lot!
– luisfer
Jan 4 at 4:33
It worked perfectly! Thanks a lot!
– luisfer
Jan 4 at 4:33
@luisfer glad to help.
– HCK
Jan 4 at 4:46
@luisfer glad to help.
– HCK
Jan 4 at 4:46
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54030118%2fhow-to-use-git-with-laravel%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
When you clone a Laravel repo, you need to run
composer installto create your/vendorfolder (which is in.gitignore). Beside that, you generally just need to copy.env.exampleto.env, configure any keys in that file to what you need, adjust some permissions on folders (depending on your setup) and then you're good to go. Essentially, no, you don't want to delete.gitignore; it's there for a reason.– Tim Lewis
Jan 3 at 21:40
You can see sitepoint.com/deploy-website-using-laravel-git
– Nicolás Alarcón Rapela
Jan 3 at 21:42
I was reading precisely that sitepoint article, but it looks to do something much more complex than what I need right now
– luisfer
Jan 3 at 21:50