Is it possible to integrate Zeppelin notes with git? - apache-zeppelin

Is it possible to integrate Zeppelin notes with git? One can set the repository location but how to set that to a remote git repository.
This functionality is however, available on Amazon EMR

Yes. It's possible
I use following way.
Create a github repo and push all note book. like
git clone https://github.com/rockiey/zeppelin-notebooks.git
cd zeppelin-notebooks
cp -rf ../zeppelin/notebook/* .
git add -A
git commit -m "init"
git push
Delete notebook directory
cd zeppelin
rm -rf notebook
Clone github repo to notebook.
cd zeppelin
git clone https://github.com/rockiey/zeppelin-notebooks.git notebook
While I still need push to github manually
It would be great if zeppelin can connect a github repo directly

Related

Can not deploy create-react-app with token

I have been trying to deploy create-react-app, but got an error
fatal: repository 'https://github.com/charyyev2000/Portfolio-React.git/' not found
then I created a token and tried to deploy with that,
git remote add origin https://<TOKEN>#github.com/charyyev2000/Portfolio-React.git
again got an error;
Deleted repository, created again and tried to deploy, again got the same error
fatal: repository 'https://github.com/charyyev2000/Portfolio-React.git/' not found
What did I do wrong? or, is there something wrong with my homepage in packages.json?
"homepage": "https://charyyev2000.github.io/Portfolio-React",
I cant deploy from any other of my repositories too.
What should I do now.
You are new comer in Git/GitHub tools, I hope you can done this task.
Your remote repository URL is https://github.com/charyyev2000/Portfolio-React
Solution 1:
Create a new repository on the command line
echo "# Portfolio-React" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/charyyev2000/Portfolio-React.git
git push -u origin main
Solution 2: (I think you will prefer this solution, because your source code is exist).
Push an existing repository from the command line
git remote add origin https://github.com/charyyev2000/Portfolio-React.git
git branch -M main
git push -u origin main
Let's follow the guide what you see likes this
P/S: Sometime, you need
git add .
git commit -m"foo"
git push -v
or you see any guide on your console screen, let's follow guide what you see.
Your repository is probably private.
Try this: git remote set-url origin https://YOUR_GITHUB_USER#github.com/charyyev2000/Portfolio-React.git
Or use an ssh key.
https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent&ved=2ahUKEwjoysreiIjzAhVwTTABHQPHDzIQFnoECGwQAQ&sqi=2&usg=AOvVaw2B_nuIizqk0LtbV4qWtzzH

Why didn't the client folder from my project get uploaded on gitHub?

I wanted to upload a project on github repository so I can send it to my instructor and it’s my first time. All the folders’ content got uploaded except client folder and its icon looks different. Why did that happen?
I used these commands in the terminal
$ git add .
$ git commit -m "First commit"
$ git remote add origin remote repository URL
$ git remote -v
$ git push -u origin master
Edit: my client folder is a reactjs app
You would have to be a bit more specific.
One possible answer: There is a .gitignore file (hidden file) that prevents the client folder from being pushed.
Another: You simply didn't stage the client folder. Try git add ./client and then commit and push again.
In my case, Gatsby had created a .git folder in client which prevented it from being added to the repo.
rm -rf client/.git
After doing git add . check if the files are staged inside the client folder by doing git status.It may be the problem of .gitignore file which ignores specific files that are not to be committed. If client is not on .gitignore the files inside it should be staged. And if it is not staged after doing git add . you can see the individual files that are not staged after doing git status and individually add the files to staging area.

Deploying React App via FTP from Bitbucket to my server

I set this settings in pipelines in Bitbucket. Everything works well, but it doesn't look good when I commit every time Build. But when I don't make it. It says to me that I need to commit for the first time. Have someone best practice/experience?
bitbucket-pipelines.yml
# Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
pipelines:
branches:
production:
- step:
name: Build and deploy to FTP
image: node:11.9.0
caches:
- node
script:
- npm install
- npm run build
- apt-get update
- apt-get -qq install git-ftp
- git add /build
- git commit -m "Build"
- git push
- git ftp push --user $FTP_USERNAME --passwd $FTP_PASSWORD ftp://someurl.com/
- git rm /build
- git commit -m "Remove build"
- git push
If I understand properly what you are asking, you are on the page that shows the examples of templates and you are pressing the button "Commit file".
It is kind of confusing what you should do, here, indeed, but actually what you should do is to have a file called bitbucket-pipelines.yaml containing your desired behavior in the root of your repository, and then, pipelines will do the job automatically based on the instructions in this file.

Escape the colon from a command so it's not render like a label in batch files

I'll make a bat file with goes deploy my site on GitHub pages. The repository is heinpauwelyn.github.io and is made with Angular-CLI. To deploy the site I could use this command:
ng github-pages:deploy
This will place everything on the gh-pages branch but it must stand on the master branch! I'm developing on the development branch.
To automate the proceedings of committing, deploying, checkout gh-pages, copy-pasting, checkout master, copy-pasting, committing and checkout development, I've create this bat file named deploy.bat:
git status
git add *
git commit -m "deploy"
git pull
git push
ng github-pages:deploy
git checkout gh-pages
echo "copy all your files in this folder to a temporary folder outside this repository (except these inside the `.gitignore` file)"
pause
rem must be automatic done by using this xcopy . ..\temp
git checkout master
echo "copy all your file form the temporary folder back into the repository"
pause
rem rmdir /s /q .
rem xcopy ..\temp .
git status
git add *
git commit -m "deploy"
git pull
git push
echo "site is deployed!"
git checkout development
The code will stop on this line: ng github-pages:deploy. I've checked the syntax on Wikipedia and have seen that the colon is a label to skip code from a running batch file. I think this colon gives the bug.
My question is now can I escape the colon from the batch file so that it's not longer a label but a command?
Note
The goal of the batch file is that I just must use one command to deploy my full site. In the package.json file of my project, I use this code:
{
"scripts": {
"deploy": "deploy.bat"
}
}
When the bug will be solved, I just use command below to deploy my site on the master branch.
npm run deploy
It wasn't the colon that gives the bug but because ng is a batch file. Helped answer: Azure Function / Azure Website Custom Deploy Script Ending Prematurely.
After searching and asking this question, I've found the solution that works!
git status
git add *
git commit -m "deploy"
git pull
git push
call ng.cmd "github-pages:deploy"
call git checkout master
call git merge origin/gh-pages --allow-unrelated-histories
dployer.exe rem | This is a little executable file I've written (it's just for changing
rem | content of some files)
git add *
git commit -m "deploy bug oke"
git pull
git push
git checkout development
Thanks to #MCND, #Mofi and #SomethingDark for the comments 😃!

Download from gitHub [duplicate]

The command git clone git#github.com:whatever creates a directory named whatever containing a Git repository:
./
whatever/
.git
I want the contents of the Git repository cloned into my current directory ./ instead:
./
.git
Option A:
git clone git#github.com:whatever folder-name
Ergo, for right here use:
git clone git#github.com:whatever .
Option B:
Move the .git folder, too. Note that the .git folder is hidden in most graphical file explorers, so be sure to show hidden files.
mv /where/it/is/right/now/* /where/I/want/it/
mv /where/it/is/right/now/.* /where/I/want/it/
The first line grabs all normal files, the second line grabs dot-files. It is also possibe to do it in one line by enabling dotglob (i.e. shopt -s dotglob) but that is probably a bad solution if you are asking the question this answer answers.
Better yet:
Keep your working copy somewhere else, and create a symbolic link. Like this:
ln -s /where/it/is/right/now /the/path/I/want/to/use
For your case this would be something like:
ln -sfn /opt/projectA/prod/public /httpdocs/public
Which easily could be changed to test if you wanted it, i.e.:
ln -sfn /opt/projectA/test/public /httpdocs/public
without moving files around. Added -fn in case someone is copying these lines (-f is force, -n avoid some often unwanted interactions with already and non-existing links).
If you just want it to work, use Option A, if someone else is going to look at what you have done, use Option C.
The example I think a lot of people asking this question are after is this. If you are in the directory you want the contents of the git repository dumped to, run:
git clone git#github.com:whatever .
The "." at the end specifies the current folder as the checkout folder.
Go into the folder.. If the folder is empty, then:
git clone git#github.com:whatever .
else
git init
git remote add origin PATH/TO/REPO
git fetch
git checkout -t origin/master
Basic Git Repository Cloning
You clone a repository with
git clone [url]
For example, if you want to clone the Stanford University Drupal Open Framework Git library called open_framework, you can do so like this:
$ git clone git://github.com/SU-SWS/open_framework.git
That creates a directory named open_framework (at your current local file system location), initializes a .git directory inside it, pulls down all the data for that repository, and checks out a working copy of the latest version. If you go into the newly created open_framework directory, you’ll see the project files in there, ready to be worked on or used.
Cloning a Repository Into a Specific Local Folder
If you want to clone the repository into a directory named something other than open_framework, you can specify that as the next command-line option:
$ git clone git:github.com/SU-SWS/open_framework.git mynewtheme
That command does the same thing as the previous one, but the target directory is called mynewtheme.
Git has a number of different transfer protocols you can use. The previous example uses the git:// protocol, but you may also see http(s):// or user#server:/path.git, which uses the SSH transfer protocol.
You can use following git command to clone with custom directory name
git clone <git_repo_url> <your_custom_directory_name>
Note: You don't need to create your custom directory because it will create automatically
To clone git repository into a specific folder, you can use -C <path> parameter, e.g.
git -C /httpdocs clone git#github.com:whatever
Although it'll still create a whatever folder on top of it, so to clone the content of the repository into current directory, use the following syntax:
cd /httpdocs
git clone git#github.com:whatever .
Note that cloning into an existing directory is only allowed when the directory is empty.
Since you're cloning into folder that is accessible for public, consider separating your Git repository from your working tree by using --separate-git-dir=<git dir> or exclude .git folder in your web server configuration (e.g. in .htaccess file).
To clone to Present Working Directory:
git clone https://github.com/link.git
To clone to Another Directory:
git clone https://github.com/link.git ./Folder1/Folder2
Hope it Helps :)
If you want to clone into the current folder, you should try this:
git clone https://github.com/example/example.git ./
When you move the files to where you want them, are you also moving the .git directory? Depending on your OS and configuration, this directory may be hidden.
It contains the repo and the supporting files, while the project files that are in your /public directory are only the versions in the currently check-out commit (master branch by default).
Usage
git clone <repository>
Clone the repository located at the <repository> onto the local machine. The original repository can be located on the local filesystem or on a remote machine accessible via HTTP or SSH.
git clone <repo> <directory>
Clone the repository located at <repository> into the folder called <directory> on the local machine.
Source: Setting up a repository
Clone:
git clone git#jittre.unfuddle.com:jittre/name.git
Clone the "specific branch":
git clone -b [branch-name] git#jittre.unfuddle.com:jittre/name.git
Make sure you remove the .git repository if you are trying to check thing out into the current directory.
rm -rf .git then git clone https://github.com/symfony/symfony-sandbox.git
From some reason this syntax is not standing out:
git clone repo-url [folder]
Here folder is an optional path to the local folder (which will be a local repository).
Git clone will also pull code from remote repository into the local repository.
In fact it is true:
git clone repo-url = git init + git remote add origin repo-url + git pull
Here's how I would do it, but I have made an alias to do it for me.
$ cd ~Downloads/git; git clone https:git.foo/poo.git
There is probably a more elegant way of doing this, however I found this to be easiest for myself.
Here's the alias I created to speed things along. I made it for zsh, but it should work just fine for bash or any other shell like fish, xyzsh, fizsh, and so on.
Edit ~/.zshrc, /.bashrc, etc. with your favorite editor (mine is Leafpad, so I would write $ leafpad ~/.zshrc).
My personal preference, however, is to make a zsh plugin to keep track of all my aliases. You can create a personal plugin for oh-my-zsh by running these commands:
$ cd ~/.oh-my-zsh/
$ cd plugins/
$ mkdir your-aliases-folder-name; cd your-aliases-folder-name
# In my case '~/.oh-my-zsh/plugins/ev-aliases/ev-aliases'
$ leafpad your-zsh-aliases.plugin.zsh
# Again, in my case 'ev-aliases.plugin.zsh'
Afterwards, add these lines to your newly created blank alises.plugin file:
# Git aliases
alias gc="cd ~/Downloads/git; git clone "
(From here, replace your name with mine.)
Then, in order to get the aliases to work, they (along with zsh) have to be sourced-in (or whatever it's called). To do so, inside your custom plugin document add this:
## Ev's Aliases
#### Remember to re-source zsh after making any changes with these commands:
#### These commands should also work, assuming ev-aliases have already been sourced before:
allsource="source $ZSH/oh-my-zsh.sh ; source /home/ev/.oh-my-zsh/plugins/ev-aliases/ev-aliases.plugin.zsh; clear"
sourceall="source $ZSH/oh-my-zsh.sh ; source /home/ev/.oh-my-zsh/plugins/ev-aliases/ev-aliases.plugin.zsh"
####
####################################
# git aliases
alias gc="cd ~/Downloads/git; git clone "
# alias gc="git clone "
# alias gc="cd /your/git/folder/or/whatever; git clone "
####################################
Save your oh-my-zsh plugin, and run allsource. If that does not seem to work, simply run source $ZSH/oh-my-zsh.sh; source /home/ev/.oh-my-zsh/plugins/ev-aliases/ev-aliases.plugin.zsh. That will load the plugin source which will allow you to use allsource from now on.
I'm in the process of making a Git repository with all of my aliases. Please feel free to check them out here: Ev's dot-files. Please feel free to fork and improve upon them to suit your needs.
If you are in the directory you want the contents of the git repository dumped to, run:
git clone git#github.com:origin .
The "." at the end specifies the current folder as the checkout folder.
If you are using ssh for git cloning you can use the following command.
git -C path clone git#github.com:path_to_repo.git
eg:
git -C /home/ubuntu/ clone git#github.com:kennethreitz/requests.git would pull the git repository for requests to your /home/ubuntu/ path.
go to the directory where you want to clone the repo.
(don't run git init command inside that directory)
simply run the command,
git clone <git repo url> .
Example: git clone https://github.com/Rashmi-Wijesekara/portfolio.git .
Although all of the answers above are good, I would like to propose a new method instead of using the symbolic link method in public html directory as proposed BEST in the accepted answer. You need to have access to your server virtual host configurations.
It is about configuring virtual host of your web server directly pointing to the repository directory. In Apache you can do it like:
DocumentRoot /var/www/html/website/your-git-repo
Here is an example of a virtual host file:
<VirtualHost *:443>
ServerName example.com
DocumentRoot /path/to/your-git-repo
...
...
...
...
</VirtualHost>
If you use github cli you can use the following command:
gh repo clone <repository> [<directory>] [-- <gitflags>...]
So for example you can run this:
gh repo clone repository-name-on-github my-local-folder
For Windows user
1> Open command prompt.
2> Change the directory to destination folder (Where you want to store your project in local machine.)
3> Now go to project setting online(From where you want to clone)
4> Click on clone, and copy the clone command.
5> Now enter the same on cmd .
It will start cloning saving on the selected folder you given .
Regarding this line from the original post:
"I know how to move the files after I've cloned the repo, but this
seems to break git"
I am able to do that and I don't see any issues so far with my add, commit, push, pull operations.
This approach is stated above, but just not broken down into steps.
Here's the steps that work for me:
clone the repo into any fresh temporary folder
cd into that root folder you just cloned locally
copy the entire contents of the folder, including the /.git directory - into any existing folder you like; (say an eclipse project that you want to merge with your repo)
The existing folder you just copied the files into , is now ready to interact with git.

Resources