Nodejs script to fill in the repository.?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
12 views
I wondered: - is it possible to create a script that wakes the machine to komitite files on github ?
- Probably Yes, and probably this should be done through the execution of the commands in git bash. I said to myself and searched the Internet.
Created a repository in hand in hand made a few..
Then prescribed
var exec = require('child_process').exec; exec('git status',{cwd:'./public/'},function(error,stdout,stderr){console.log(stdout);});

And when I saw reply I was very glad
On branch master Your branch is up-to-date with 'origin/master'. Changes to be committed: (use "git reset HEAD ..." to unstage) modified: library.js modified: library.min.js

Then another line
exec('git add .',{cwd:'./public/'},function(error,stdout,stderr){console.log(stdout);});

And the answer
On branch master Your branch is up-to-date with 'origin/master'. Changes to be committed: (use "git reset HEAD ..." to unstage) modified: library.js modified: library.min.js

Then
exec('git commit-m "',{cwd:'./public/'},function(error,stdout,stderr){console.log(stdout);});

And
exec('git push -u origin master',{cwd:'./public/'},function(error,stdout,stderr){console.log(stdout);});

But received in response only the end of the answer
Branch master set up to track remote branch 'master' from 'origin'.

I go into the repository and everything is as it was all that remained
As sdelat so that the script itself was filled with the desired files in the git repository ?
by | 12 views

1 Answer

0 like 0 dislike
So I decided
var exec = require('child_process').exec; exec('git init',{cwd:'./public/'},function(error,stdout,stderr){ exec('git status',{cwd:'./public/'},function(error,stdout,stderr){ exec('git add .',{cwd:'./public/'},function(error,stdout,stderr){ exec('git commit-m "sadsdasd"',{cwd:'./public/'},function(error,stdout,stderr){ exec('git push origin master:username,{cwd:'./public/'},function(error,stdout,stderr){ }); }); }); }); });

Instead of username you need to specify the name of the master.
by

Related questions

0 like 0 dislike
1 answer
asked Jun 4, 2019 by matros97
0 like 0 dislike
3 answers
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
35,649 users