Cloning AWS codecomit repo - git-config

I just started with the AWS codestar and wanted to clone the codecomit repo. I generated the username and password for the repo and had it saved.
I am trying to enter username and password but every time I get Unable to access error with code 403.
I have 2 question here on:
1) is there an easy way to just copy the password from .csv file which I downloaded from AWS in the git command while cloning the repo.
Typing that long password is nerve wrecking.
2) Is there a way to create a second set of git config which can be used with this repo as I already have some other git credentials saved which I do not wish to override as part of global config. Something like we do in aws-cli named profiles.

Here's the answer from Amazon AWS forum link. I hope this will answer all you queries.

Related

Installing Driverless AI on AWS

I've installed the DAI community app on an AWS instance following these instructions:
http://docs.h2o.ai/driverless-ai/latest-stable/docs/userguide/install/aws.html
https://localhost:12345 gives me the login screen. The standard credentials "h2oai" and "h2oai" return "Invalid User Id or Password". What are the credentials?
Also, DAI installed to /opt. I do not see the /data and /license folders anywhere. Where are they?
I expect that you are probably using the AWS Marketplace image and not the community ami. The AWS Marketplace image is password protected in order to observe AWS Marketplace standards. The username should be 'h2oai' and the password would be the AWS Instance ID.
With respect to the folders, the AWS Marketplace image uses our Debian install package. See documentation here: http://docs.h2o.ai/driverless-ai/latest-stable/docs/userguide/install/linux-deb.html for information about which folders are available where. The software will be installed into /opt/h2oai/dai, and you will find the log folder there, but it is better for you to access the logs and such via systemctl and journalctl.
NOTE: additional configurations folder can be found at /etc/dai

Upload local files to a virtual machine using putty

my company asked me to transfer their wordpress websites (web and database files) to another server. The other server is a virtual machine which is already running and there is already an empty shell. I have the username, ip address and password of the virtual machine where they want to transfer the file. I was able to login to the virtual machine using putty and double check the directory of that virtual machine and it seems that there is nothing yet. And I've downloaded the wordpress files and its database in local computer. And the local computer that I'm going to use dont have any internet connect but I was able to connect to the virtual machine using putty.
Questions:
- how can I transfer the wordpress files from the local computer to the virtual machine using putty?
- what command line should I type to upload the wordpress files? The command line that I've tried is this below. I logged in on the virtual machine and type the command line below. And it seems that it didnt work.
scp root#127.0.0.1:C:\Users\localComputer\Desktop\wordpress.zip /home/virtualMachine
- should I login on the virtual machine via putty and then type in the command line to upload the files from the local computer OR use command prompt from the windows and type the command lines to upload the files to the virtual machine?
The local computer Im using is windows 7 32bit. Please advise. Also, I dont know how to unzip the files once it is uploaded in the virtual machine. what command line should I used.
Well you cant upload files from your local computer through putty, you have ftp for that. To upload files from your local computer you have a couple of options.
Upload to a git repository like github and bitbucket
Check if ftp is installed and then connect through ftp.
For ftp you might first have to check if ftp is installed and then create a new user which you can then use to ftp into the server. I personally like git so i will just explain about git.
If its your first time using git, then it might be a bit tricky. But none the less you will have to learn it for the long run. Create an account on github or bitbucket, if your code is copyrighted/ Ultra top secret :P and dont want anyone to get hands on it then you have to upload it to a private repository, while if its just a wordpress theme or nothing much of any value then you can upload it to a public repository and later delete it (bitbucket has free private repositories while you have to pay for github).
After creating the account, create a new repository with the name of the project.
I personally like github, so i will explain for github. But 99% of the things are same for bitbucket as well.
First install the github globally on your OS, Once installed goto the directory you want to upload and type, these commands
git init
git add *
git commit -m "Upload code to server"
git remote add origin <github-repository-url>
git push -u origin master
if asked for username/pass just type it in. This will upload the code to github. Then on your server first install git by
sudo yum install git-all // For redhats e.g fedora, centos etc
OR
sudo apt-get install git-all // for debian e.g ubuntu
Then goto the directory you want to upload your code to and type.
git init
git clone <github-repository-url> .
Dot is important, as it tells the server to download the code in the directory that you are currently inside. Then it will start downloading all the code to your server.
Making changes like a pro
Lets say later on you want to make changes to the files on your local computer. After you make all the changes, just type
git add *
git commit -m "My new changes"
git push
And it will upload all the changes to repository you defined in the previous steps.
Then on your server, you can just type
git pull
And it will pull all the changes from the respository.

Git Siteground Deployment WordPress Sublime Text

I am a beginning developer looking to get a great workflow setup before I begin my personal website: kevinbmccall.com
The site has WordPress installed and is hosted by SiteGround.
I enjoy the Sublime Text 3 Editor and am looking to emulate the workflow described here: http://joshuaiz.com/words/the-ultimate-workflow/
I was already in the process of learning Git through the terminal and had a GitHub repo setup through a local project folder. So I didn't really follow Joshua exactly and may have been what led me to get stuck but I think I got to the SSH part.
Here is what I have done so far:
Installed Sublime Text 3 with SublimeGit Package
Installed Wordpress on kevinbmccall.com
Deleted all files from local projects/kevinbmccall folder with git
Copied all files from siteground server to local folder
Added and Committed all of these changes to github repo
Tried Adding PHP Script to siteground server and setting up webhook
Issue: "I want the server to sync with my github repo so I can easily deploy to my live site every time I push to github"
Here is what I can do now:
I can make local changes to my project folder, add them and commit them no problem.
This correctly updates my github repo fine but does not seem to deploy yet.
If I make a change to my local folder, add, commit and check the status it will tell me of an origin/master that is behind in commits and recommends a push
I can push and even see some sort of request triggered because of that attempt at a PHP script I think but I was hoping to see the test txt files show up on the server and they did not.
My Thoughts:
I think my issue has to do with writing to the server and maybe the SSH setup through Siteground. I generated a key but never really used it and all of the online material from siteground points to their SG-Git tool in the c-panel. This requires a more expensive monthly plan and I am just a beginning developer trying to get a personal site up. I am sure the deployment can be accomplished without this upgrade.
Thank you to whomever replies. My goal is to learn as much as possible so I am even more interested in the explanation than the solution.
In my opinion, maybe you need GitHub Webhooks.
This is a demo
// Init vars
$LOCAL_ROOT = "/var/www/my_new_site";
$LOCAL_REPO_NAME = "public_html";
$LOCAL_REPO = "{$LOCAL_ROOT}/{$LOCAL_REPO_NAME}";
$REMOTE_REPO = "git#github.com:jonathanstark/my_new_site.git";
$DESIRED_BRANCH = "dev";
// Delete local repo if it exists
if (file_exists($LOCAL_REPO)) {
shell_exec("rm -rf {$LOCAL_REPO}");
}
// Clone fresh repo from github using desired local repo name and checkout the desired branch
echo shell_exec("cd {$LOCAL_ROOT} && git clone {$REMOTE_REPO} {$LOCAL_REPO_NAME} && cd {$LOCAL_REPO} && git checkout {$BRANCH}");
die("done " . mktime());

Manage wordpress blog on remote server via git

I want to be able to develop my plugins & themes on my machine and the changes be reflected on my server almost instantly. Also I want a backup plan. So git & github seems a very good solution. I want to make regular changes to the server (push from local) and once in a while upload them on github too (local to github or remote to github).
The question is can I clone the repo from github to my remote server and to my local machine and be able to push from local to remote or pull from github to remote (if I'm not at home)?
Edit: I did a research and I found out that I actually need a bare repo in the server, but i want it to be able to push/pull to/from github.
In github and bitbucket (https://bitbucket.org) you can add any number of ssh keys from different machines and push and pull from anywhere you want. The command to generate such a key is
ssh-keygen
answer the questions with enter and the ssh key will be in /home/user/.ssh/id_rsa.pub. You have to do this for every machine you want to push and when the repository is set to private, yo also have to do it for those machines, you want to pull from.
So the workflow would be
editing locally
pushing to github/butbucket repo: git push -u origin
log in to the machine where wordpress is running: git pull

Repo from RStudio to Github

I love github and RStudio for workflow. Recently, I've created a project template that makes directories and scripts etc. and would like to create locally and push to github.
In the past I created a repo for a project via https://github.com/ used version control in RStudio to create the local repo and then dump all files I already had there.
This seems wasteful of time. How can one to take the directory/repo that's already in RStudio with a .Rproj file and upload to github with out first creating the shell repo at https://github.com/?
I think this could save time in the workflow.
I thought I could just follow the directions -here- (under Adding version control to a project) to add version control but this doesn't allow me to push to github (nor should it because how does RStudio know which git site you want to push to).
The only way you could create a repository on github directly from your computer, without having to create it with their website first, would be to create a remote branch directly from git on your system. This is possible on some git installation, but not on Github.
However, Github provides an API that allows to create the repository from the command line, via a call to curl for example. You will find information on how to do it in this answer (not tested) :
curl -u 'USER:PASS' https://api.github.com/user/repos -d '{"name":"REPO"}'
git remote add origin git#github.com:USER/REPO.git
git push origin master
But I don't think you will be able to do it directly from RStudio : you will need to put your project under version control, and then to execute the three commands provided in the answer in a shell.
Have you seen hub?
hub create
git push -u origin master
will do the job for you, once hub is configured to access your GitHub account. If you want the project to be called different from the name of the parent directory, use
hub create projectname
The general usage is
hub create [NAME] [-p] [-d DESCRIPTION] [-h HOMEPAGE]
(-p -- private repository), and you can access many more GitHub features with this tool.

Resources