git clone

Discussion on computers, ROMS installation and compiling

Moderators: arango, robertson

Post Reply
Message
Author
rdfleay

git clone

#1 Unread post by rdfleay »

HI!
Followed the instructions from here https://www.myroms.org/wiki/Git, but cannot checkout of 'git' with myroms.org re-loading the password request ..

Code: Select all

rdfleay@rdfleay-Lenovo-G50-45:~/Documents/Study/ROMS$ git checkout HEAD -- "$(git rev-parse --show-toplevel)"
Password for 'https://rdfleay@www.myroms.org': 
Password for 'https://rdfleay@www.myroms.org': 
..and no git ID from my 'cppdefs.h' file also evident..

Code: Select all

!git $Id$
!svn $Id: mod_ncparam.F 1051 2020-12-04 23:09:05Z arango $
passwords and username are correct with login accepted (I'm here! ;) )

I tried to bash through svn earlier and made it through some stages, but made a mistake as now i get

Code: Select all

Skipped '.'
svn: E155007: None of the targets are working copies
and the forums ...so many forums.. provided a few options but alas computer says no..

stack suggests a config file edit..

Code: Select all

Open .git/config and find the [remote "origin"] section. Make sure you're using the SSH one:

ssh://git@github.com/username/repo.git
and although i have a gitlab account for R projects with some experience .. it seems that this is something different and I have crashed my systems already trying to setup both UDELFT3D and now this...

ideally, I have gitlab account and so having the 'setup' in-line with that.. if possible..

THANKS

User avatar
kate
Posts: 4088
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: git clone

#2 Unread post by kate »

Did you do a "git clone" first? You can checkout different branches/tags once you have the clone.

rdfleay

Re: git clone

#3 Unread post by rdfleay »

Hey Kate,
Thanks for the attention! steps copied from the wiki..

Code: Select all

rdfleay@rdfleay-Lenovo-G50-45:~/Documents/Study/ROMS$ git clone https://rdfleay@www.myroms.org/git/src ~/Documents/Study/ROMS
fatal: destination path '/home/rdfleay/Documents/Study/ROMS' already exists and is not an empty directory.
deleted the ROMS install manual..

Code: Select all

rdfleay@rdfleay-Lenovo-G50-45:~/Documents/Study/ROMS$ git clone https://rdfleay@www.myroms.org/git/src ~/Documents/Study/ROMS
Cloning into '/home/rdfleay/Documents/Study/ROMS'...
Password for 'https://rdfleay@www.myroms.org': 
empty folder in OS ..success with file import AND password accepted

Code: Select all

remote: Counting objects: 36163, done.
remote: Compressing objects: 100% (6872/6872), done.
remote: Total 36163 (delta 33154), reused 32001 (delta 29192)
Receiving objects: 100% (36163/36163), 20.06 MiB | 1.56 MiB/s, done.
Resolving deltas: 100% (33154/33154), done.
rdfleay@rdfleay-Lenovo-G50-45:~/Documents/Study/ROMS$ git config filter.id.smudge ".git_filters/id.smudge %f"
rdfleay@rdfleay-Lenovo-G50-45:~/Documents/Study/ROMS$ git config filter.id.clean ".git_filters/id.clean %f"
rdfleay@rdfleay-Lenovo-G50-45:~/Documents/Study/ROMS$ rm .git/index
rdfleay@rdfleay-Lenovo-G50-45:~/Documents/Study/ROMS$ git checkout HEAD -- "$(git rev-parse --show-toplevel)"
Password for 'https://rdfleay@www.myroms.org': 
further steps processed successfully (i assume.. no ERROR messages and files in my OS~Documents/Study/ROMS folder)
BUT the password request keeps cycling.. so i enter the same password it accepted in the previous step AND to enter this forum..etc

Code: Select all

Password for 'https://rdfleay@www.myroms.org': 
Password for 'https://rdfleay@www.myroms.org': 
Password for 'https://rdfleay@www.myroms.org': 
Password for 'https://rdfleay@www.myroms.org': 
Perhaps i should just ignore this..? i have entered the password and even though it keeps requesting.. i simply close the terminal and try to proceed..? its difficult to take that initiative as 1 wrong move.. and your lcked out of the system, as experienced with the attempted svn sync of the dbase..
thanks

User avatar
kate
Posts: 4088
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: git clone

#4 Unread post by kate »

Sorry, maybe Dave can answer? I only use git via github.

User avatar
robertson
Site Admin
Posts: 219
Joined: Wed Feb 26, 2003 3:12 pm
Location: IMCS, Rutgers University

Re: git clone

#5 Unread post by robertson »

I have not confirmed this, but I believe that the "git checkout" and/or "git rev-parse" commands actually result in multiple git commands being executed and each git command is asking for your password. Set up a credential manager (explained further down on the ROMS Git wiki page) and try again.

That said, I do see some "Password Mismatch" errors (only one from today) connected to your username in the logs, so if the credential manager doesn't work let us know.

rdfleay

Re: git clone

#6 Unread post by rdfleay »

Thanks for the attention robertson,
It is difficult to take that 'jump' into undocumented territory from these documented (thankfully) stages... as assumptions in code for us newb's usually leads to fun activities, like un-locking / re-config's git's , share file re-compile.. to this and other projects..etc etc
So.. for others, as detailed below and here..

1. ensure your destination folder for the clone (download of Git repository files for the model) is empty, stated earlier/below in this thread
2. Follow Git Clone steps of the ROMS directory (in my experience the easiest and fastest) following the wonderfully documented 'bash' https://www.myroms.org/wiki/Git... AND '
3. when arriving at the

Code: Select all

git checkout HEAD -- "$(git rev-parse --show-toplevel)"
Password for 'https://rdfleay@www.myroms.org': 
Password for 'https://rdfleay@www.myroms.org': 
Password for 'https://rdfleay@www.myroms.org': 
Password for 'https://rdfleay@www.myroms.org': 
Password for 'https://rdfleay@www.myroms.org': 
Password for 'https://rdfleay@www.myroms.org': 
Password for 'https://rdfleay@www.myroms.org': 
Password for 'https://rdfleay@www.myroms.org': 
Password for 'https://rdfleay@www.myroms.org': 
Password for 'https://rdfleay@www.myroms.org': 
Password for 'https://rdfleay@www.myroms.org': 
Password for 'https://rdfleay@www.myroms.org': 
Password for 'https://rdfleay@www.myroms.org': 
Password for 'https://rdfleay@www.myroms.org': 
Password for 'https://rdfleay@www.myroms.org': 
Password for 'https://rdfleay@www.myroms.org': 
Password for 'https://rdfleay@www.myroms.org': 
Password for 'https://rdfleay@www.myroms.org': 
Password for 'https://rdfleay@www.myroms.org': 
Password for 'https://rdfleay@www.myroms.org': 
Password for 'https://rdfleay@www.myroms.org': 
...be prepared for 20x password entry for the list of git commands..
at which point when you go check the file..

#include "cppdefs.h"
MODULE mod_ncparam

..as mentioned in the wikiROMS git page, the git HASH will now be present.. enter your git ID (name, email) , and 'git pull' SHOULD then work! :)
and then of course the following steps with 'Saving ROMS Login Credentials' so that future git-pulls/ROMS-compiles will not require the above password stage.

rdfleay

Re: git clone

#7 Unread post by rdfleay »

gpg created

Code: Select all

rdfleay@rdfleay-Lenovo-G50-45:~$ gpg --list-key
gpg: checking the trustdb
gpg: marginals needed: 3  completes needed: 1  trust model: pgp
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: next trustdb check due at 2022-12-17
/home/rdfleay/.gnupg/pubring.kbx
--------------------------------
pub   rsa2048 2010-10-19 [SCA] [expired: 2020-10-16]
      E298A3A825C0D65DFD57CBB651716619E084DAB9
uid           [ expired] Michael Rutter <marutter@gmail.com>

pub   rsa3072 2020-12-17 [SC] [expires: 2022-12-17]
      A1B8XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX (numbers replaced by me in forum post 'with X')
uid           [ultimate] rdfleay <rdfleay@gmai.com>
sub   rsa3072 2020-12-17 [E] [expires: 2022-12-17]
'git-credential-netrc' downloaded

Code: Select all

rdfleay@rdfleay-Lenovo-G50-45:~/bin$ ls
afm2tfm       gftopk                mf         teckit_compile
bibtex        gftype                mf-nowin   tex
dvilualatex   git-credential-netrc  mft        texhash
enter home directory 'cd ~' and enter commands in single command line

Code: Select all

vi .netrc machine www.myroms.org login rdfleay password -my password- protocol https
terminal does some funky run..

Code: Select all

~                                                                          
~                                                                          
~                                                                          
~                                                                          
~                                                                          
~                                                                          
~                                                                          
~                                                                          
~   
a hidden '.nrc.swp' file appears in the root (Home) directory.. but no '.netrc.gpg', and the terminal reads fail...

Code: Select all

rdfleay@rdfleay-Lenovo-G50-45:~$ gpg -e -r rdfleay@gitlab.com .netrc
gpg: error retrieving 'rdfleay@gitlab.com' via WKD: No data
gpg: rdfleay@gitlab.com: skipped: No data
gpg: .netrc: encryption failed: No data
i also followed these precise instructions https://termlen0.github.io/2017/04/20/observations/,

Code: Select all

rdfleay@rdfleay-Lenovo-G50-45:~$ gpg --encrypt --recipient rdfleay@gmail.com .netrc
gpg: error retrieving 'rdfleay@gmail.com' via WKD: No data
gpg: rdfleay@gmail.com: skipped: No data
gpg: .netrc: encryption failed: No data
and so I'm a few steps away from checking out updates AND progressing my newb skills.. so that I can actually start to consider the physics (numerically)..
THANKS!

User avatar
robertson
Site Admin
Posts: 219
Joined: Wed Feb 26, 2003 3:12 pm
Location: IMCS, Rutgers University

Re: git clone

#8 Unread post by robertson »

I have rearranged the documentation on the WikiROMS Git page so instructions for setting up a credential manager comes before instructions for downloading the code.

rdfleay

Re: git clone

#9 Unread post by rdfleay »

ok, but the '.netrc' file step may be another road-block.. for newb's.. physics is one thing, computer 'brain' is another :P
here https://bryanwweber.com/writing/persona ... fa-access/ details it as 2FA ..which i don't have experience with... only ssh-keys previously with R.. and now gpg-keys... and isn't really detailed in the wikiROMS .. or here https://andrearichiardi.com/blog/posts/ ... netrc.html ...but i guess that is what we are doing (its 'somewhat' easier to trouble-shoot when the goal is known :lol: ) ... and ~grep searching within command-line to find IF these commands really worked (eg. the .netrc.gpg file) just leads to further blanks..anyway

the 'machine' token for instance should be 'github' ..or in my case 'gitlab' (?) ..as opposed to www.myroms.org... (?) .. and we need APIKEY tokens from github...?

slowly getting there BUT systematically documenting for future oceanographers!

THANK YOU robertson

rdfleay

Re: git clone

#10 Unread post by rdfleay »

after searching a few threads, blogs etc.. of which this was the most user-friendly https://andrearichiardi.com/blog/posts/ ... .html#fn-2;)
..and reading from my gitlab page.. (identified here https://screenful.com/gitlab/gitlab-apikey)

Personal Access Tokens
You can generate a personal access token for each application you use that needs access to the GitLab API.
You can also use personal access tokens to authenticate against Git over HTTP. They are the only accepted password when you have Two-Factor Authentication (2FA) enabled.

and then simply going back to the Terminal and running

Code: Select all

cd ~/Documents/Study/ROMS #access ROMS git in my OS
git pull
# pull latest commits

maybe safe to assume that 'git pull' is enough for working WITH the model..not on it.. HOWEVER.. all help with enabling gitlab connection to the model/updates is much appreciated, especially for those of us spending time on the physics and applications, rather than IT :)
THANK YOU

User avatar
robertson
Site Admin
Posts: 219
Joined: Wed Feb 26, 2003 3:12 pm
Location: IMCS, Rutgers University

Re: git clone

#11 Unread post by robertson »

rdfleay wrote: Thu Dec 17, 2020 3:25 pm
enter home directory 'cd ~' and enter commands in single command line

Code: Select all

vi .netrc machine www.myroms.org login rdfleay password -my password- protocol https
terminal does some funky run..
I have adjusted the documentation to clarify but vi is a common text editor you could use to enter the next few lines into a file named ".netrc". If it were meant to be one command there would have been line continuations (\) at the end of each line to denote that. The expected command is vi .netrc. Then you would enter the next four lines (replacing joe_roms and secret with your username and password) in the text file and save and exit vi.

By putting everything in one command line you have asked vi to create and edit each of those words as a filename one by one. I'm not sure how you got back to the terminal without typing ":qa" or killing the vi process somehow. If you are unfamiliar with Linux text editors, I highly suggest you pick one and learn how to use it because you will need it if you plan to model with ROMS.

rdfleay

Re: git clone

#12 Unread post by rdfleay »

yes, i use nano.. but i should have simply searched the 'vi text editor' ..hindsight being the mother of invention!
for others..
https://www.howtogeek.com/102468/a-begi ... s-with-vi/

for those encountering error with the next encryption step..

Code: Select all

gpg -e -r rdfleay@gitlab.com .netrc
gpg: error retrieving 'rdfleay@gitlab.com' via WKD: No data
gpg: rdfleay@gitlab.com: skipped: No data
gpg: .netrc: encryption failed: No data
this link https://docs.github.com/en/free-pro-tea ... igning-keyprovides the update/install required for the encryption to work

Code: Select all

sudo apt install gnupg2
which when functioning returns

Code: Select all

gpg -e rdfleay@gitlab.com .netrc
usage: gpg [options] --encrypt [filename]
..and from then on, everything ran smooth! which is great to have as a solid-base, so future errors/road-blocks can rest on the fact that the system is completely connected, updated, and focus is not worn with 'maybe there's a bug in the build..?' ..
thanks kate and robertson.. i hope my future questions will be regarding model variables/actual modelling :D
MUCH appreciated
Ryan

ps. if you feel up to it.. ;)
even though i created a gpg key (linked to my email and defined for my gitlab account).. it does not show on my gitlab key settings (gpg)..

Code: Select all

There are no GPG keys with access to your account. 

yet the 'git clone' and subsequent 'pulls' function correctly.. i guess the 'gpg --gen-key' and '.netrc' operations are JUST linked to that file encryption on my OS and the 'git config' operations simply connect to that file and nothing involving the actual gpg key..

Post Reply