Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^5: perl in the stars

by Aldebaran (Curate)
on Dec 19, 2022 at 20:15 UTC ( #11148983=note: print w/replies, xml ) Need Help??


in reply to Re^4: perl in the stars
in thread perl in the stars

Thx, hippo, I had gotten that far. I was able to find syntax help at gitlab help forum.

fritz@laptop:~/.ssh$ ssh -T git@gitlab.com Welcome to GitLab, @tallharry66! fritz@laptop:~/.ssh$

But I still can't get over the hump. I try to imitate what I remember doing with github, but I'm not getting through the usual command sequence:

cd existing_repo git remote add origin https://gitlab.com/perlmonks/betelgeuse.git git branch -M main git push -uf origin main

I am making progress:

fritz@laptop:~/Documents/gitlab1$ git init Initialized empty Git repository in /home/fritz/Documents/gitlab1/.git +/ fritz@laptop:~/Documents/gitlab1$ ll total 36 drwxrwxr-x 4 fritz fritz 4096 Dec 19 13:07 ./ drwxr-xr-x 10 fritz fritz 4096 Dec 17 16:47 ../ -rwxrwxr-x 1 fritz fritz 1122 Dec 17 00:34 1.betelgeuse.pl* -rwxrwxr-x 1 fritz fritz 1916 Dec 18 22:44 2.betelgeuse.pl* -rwxrwxr-x 1 fritz fritz 1890 Dec 18 22:38 2.betelgeuse.pl.bak* -rwxrwxr-x 1 fritz fritz 1783 Dec 18 23:57 3.betelgeuse.pl* -rwxrwxr-x 1 fritz fritz 1737 Dec 18 23:51 3.betelgeuse.pl.bak* drwxr-xr-x 2 fritz fritz 4096 Dec 15 21:44 conf_files/ drwxrwxr-x 7 fritz fritz 4096 Dec 19 13:07 .git/ fritz@laptop:~/Documents/gitlab1$ git remote add origin https://gitlab +.com/perlmonks/betelgeuse.git fritz@laptop:~/Documents/gitlab1$ git branch -M main error: refname refs/heads/master not found fatal: Branch rename failed fritz@laptop:~/Documents/gitlab1$ git push -uf origin main error: src refspec main does not match any error: failed to push some refs to 'https://gitlab.com/perlmonks/betel +geuse.git' fritz@laptop:~/Documents/gitlab1$

What am I missing now?

Other Git Resources

gitlab docs

git cheat sheet

Cheers,

Replies are listed 'Best First'.
Re^6: perl in the stars
by hippo (Bishop) on Dec 19, 2022 at 22:36 UTC
    fritz@laptop:~/Documents/gitlab1$ git init

    This command has worked and has created an empty repo. Nothing you have done after that has put anything into the local repo at all. This is the crux of the problem.

    See Git Basics - Getting a Git Repository for some info on how to put things into your local repo and perhaps you can take it from there.


    🦛

      See Git Basics - Getting a Git Repository for some info on how to put things into your local repo and perhaps you can take it from there.

      Thx, hippo, I keep pecking away at the right markup for these commands, but I just can't get the ball to go down:

      fritz@laptop:~/Documents/gitlab1$ git add *.pl fritz@laptop:~/Documents/gitlab1$ git add README.md fritz@laptop:~/Documents/gitlab1$ git commit -m 'Initial project versi +on' 4 files changed, 237 insertions(+) create mode 100755 1.2.solstice.pl create mode 100755 1.betelgeuse.pl create mode 100755 2.betelgeuse.pl create mode 100755 3.betelgeuse.pl fritz@laptop:~/Documents/gitlab1$ git config --global user.name "Aldeb +aran" fritz@laptop:~/Documents/gitlab1$ git config --global user.email tallh +arry66@yahoo.com fritz@laptop:~/Documents/gitlab1$ git status On branch master Untracked files: (use "git add <file>..." to include in what will be committed) 1.2.solstice.pl.bak 2.betelgeuse.pl.bak 3.betelgeuse.pl.bak conf_files/ nothing added to commit but untracked files present (use "git add" to +track) fritz@laptop:~/Documents/gitlab1$ git push origin master Username for 'https://gitlab.com': tallharry66@yahoo.com Password for 'https://tallharry66@yahoo.com@gitlab.com': remote: HTTP Basic: Access denied. The provided password or token is i +ncorrect or your account has 2FA enabled and you must use a personal +access token instead of a password. See https://gitlab.com/help/topic +s/git/troubleshooting_git#error-on-git-fetch-http-basic-access-denied fatal: Authentication failed for 'https://gitlab.com/perlmonks/betelge +use.git/' fritz@laptop:~/Documents/gitlab1$

      I'm getting closer, but I'm confused. What was the whole point of setting up an SSH key if they are asking me for a password? BTW, I think I got the password right.

      fritz@laptop:~/Documents/gitlab1$ perl -d 1.2.solstice.pl Loading DB routines from perl5db.pl version 1.55 Editor support available. Enter h or 'h h' for help, or 'man perldebug' for more help. main::(1.2.solstice.pl:10): my $file = '/home/fritz/Documents/gitla +b1/1.solstice.txt'; DB<1> c + 1.2.solstice.pl 43 -116 Sun rise is Sun Dec 25 15:13:46 2022 UT Dec'2020 Solstice (UTC): 2022-12-21 21:47:33 Dec'2020 Solstice (TDT): 2022-12-21 21:49:10 Debugged program terminated. Use q to quit or R to restart, use o inhibit_exit to avoid stopping after program termination, h q, h R or h o to get additional info. DB<1> q

      Fishing for tips, and have a Happy 4th Day of Solstice! Yay Darkness!!!

        I'm getting closer, but I'm confused. What was the whole point of setting up an SSH key if they are asking me for a password?

        You are getting closer because now your repo has something in it, so that's better.

        You have set up a remote which uses https instead of ssh. Use git remote -v to show the remote URLs and you will see this. Change them to be ssh remotes instead so that you can use your key pair and you should be good to go.


        🦛

        to elaborate on hippo's reply:
        in Re^5: perl in the stars you said:
        git remote add origin https://gitlab.com/perlmonks/betelgeuse.git
        There are two ways to pull from your repository:
        • HTTPS - which uses the same username and password as their web interface, and is usually read only/pull only
        • (implicit) SSH, which uses an URL starting with git@gitlab.com: instead of https://gitlab.com/ and uses the SSH certificate you uploaded on the setup page
        (similiar for other git services)

        By the way, is the "perlmonks" part in your URL real? This would imply your user name there is "perlmonks", since the URLs usually are "username/repo-name.git". If you look at your repo in the web interface, there is a (blue) button "Clone" above the file list, which should show you both URLs for HTTPS and SSH.

Re^6: perl in the stars
by soonix (Canon) on Dec 20, 2022 at 09:59 UTC
    Instead of
    git remote add origin https://gitlab.com/perlmonks/betelgeuse.git
    you should do
    git remote add origin git@gitlab.com:perlmonks/betelgeuse.git
    Although this URL doesn't mention ssh, it will use it.
      Instead of ... you should do

      I'm trying to get there soonix, but I can't get the ball to drop:

      git remote add origin git@gitlab.com:perlmonks/simbad2.git

      strike 1

      git remote add origin git@gitlab.com/tallharry66/simbad2.git

      strike 2

      git remote add origin git@gitlab.com/perlmonks/simbad3.git

      Casey's back on the mound:

      fritz@laptop:~/Documents/simbad3$ git init Initialized empty Git repository in /home/fritz/Documents/simbad3/.git +/ fritz@laptop:~/Documents/simbad3$ git add * fritz@laptop:~/Documents/simbad3$ git remote add origin git@gitlab.com +/perlmonks/simbad3.git fritz@laptop:~/Documents/simbad3$ git remote origin fritz@laptop:~/Documents/simbad3$ git remote -v origin git@gitlab.com/perlmonks/simbad3.git (fetch) origin git@gitlab.com/perlmonks/simbad3.git (push) fritz@laptop:~/Documents/simbad3$ ll total 20 drwxrwxr-x 3 fritz fritz 4096 Jan 2 01:26 ./ drwxr-xr-x 13 fritz fritz 4096 Jan 2 01:25 ../ -rwxrwxr-x 1 fritz fritz 257 Dec 31 21:38 1.simbad.pl* drwxrwxr-x 7 fritz fritz 4096 Jan 2 01:27 .git/ -rw-rw-r-- 1 fritz fritz 721 Jan 2 01:08 README.md fritz@laptop:~/Documents/simbad3$ git branch -M main error: refname refs/heads/master not found fatal: Branch rename failed fritz@laptop:~/Documents/simbad3$ git commit -m 'Initial project versi +on' [master (root-commit) c5706b8] Initial project version 2 files changed, 26 insertions(+) create mode 100755 1.simbad.pl create mode 100644 README.md fritz@laptop:~/Documents/simbad3$ git push -uf origin main error: src refspec main does not match any error: failed to push some refs to 'git@gitlab.com/perlmonks/simbad3.g +it' fritz@laptop:~/Documents/simbad3$

      Busto again. I know I've lost it when I see:

      fritz@laptop:~/Documents/simbad3$ git branch -M main error: refname refs/heads/master not found

      Trying to understand this: git basics working with remotes

      Just can't git her done....

        fritz@laptop:~/Documents/simbad3$ git commit -m 'Initial project versi +on' [master (root-commit) c5706b8] Initial project version 2 files changed, 26 insertions(+) create mode 100755 1.simbad.pl create mode 100644 README.md fritz@laptop:~/Documents/simbad3$ git push -uf origin main error: src refspec main does not match any error: failed to push some refs to 'git@gitlab.com/perlmonks/simbad3.g +it' fritz@laptop:~/Documents/simbad3$

        From this you are trying to push a branch called "main" which doesn't exist. Your branch is called "master" - push that instead.

        It is still unlikely to work because your remote URL looks wrong (it has no colon).


        🦛

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11148983]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (2)
As of 2023-09-23 22:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?