Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: fatal: could not read Username #451

Closed
q121212 opened this issue Nov 1, 2022 · 13 comments
Closed

Error: fatal: could not read Username #451

q121212 opened this issue Nov 1, 2022 · 13 comments
Labels
type: question Further information is requested

Comments

@q121212
Copy link

q121212 commented Nov 1, 2022

Hi,
chunk of git action:

      - name: Get current date
        id: date
        run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
      - name: Upload to new branch
        uses: EndBug/add-and-commit@v9
        with:
          message: test_message
          add: '*.parquet'
          new_branch: test_${{ steps.date.outputs.date }}
          push: false

error:

Run EndBug/add-and-commit@v9
  with:
    message: test_message
    add: *.parquet
    new_branch: test_2022-11-01
    push: false
    cwd: .
    default_author: github_actor
    fetch: --tags --force
    pathspec_error_handling: ignore
    github_token: ***
  
Running in /home/runner/work/get_data/get_data
Add input parsed as single string, running 1 git add command.
> Using 'q121212 <[email protected]>' as author.
> Using "test_message" as commit message.
Internal logs
  > Staging files...
  > Adding files...
  > No files to remove.
  > Checking for uncommitted changes in the git working tree...
  > Found 1 changed files.
  > Fetching repo...
  Error: Error: fatal: could not read Username for 'https://github.com/': No such device or address

I tried also without push: false but got the same error
I don't know how to start a new branch
I saw the same errors in Issues but it wasn't possible to correct my case based on them
Could you help me figure it out?

@q121212 q121212 added the type: question Further information is requested label Nov 1, 2022
@q121212
Copy link
Author

q121212 commented Nov 1, 2022

could not read Username fixed by using step

      - name: Clone repo
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

before the step:

- name: Upload to new branch
        uses: EndBug/add-and-commit@v9
with:
        message: test_message
        add: '*.parquet'
        new_branch: test_${{ steps.date.outputs.date }}
        push: true

but another problem happened:

Run EndBug/add-and-commit@v9
  with:
    message: test_message
    add: *.parquet
    new_branch: data_2022-11-01
    push: true
    cwd: .
    default_author: github_actor
    fetch: --tags --force
    pathspec_error_handling: ignore
    github_token: ***
Running in /home/runner/work/get_data/get_data
Add input parsed as single string, running 1 git add command.
> Using 'q121212 <[email protected]>' as author.
> Using "test_message" as commit message.
Internal logs
  > Staging files...
  > Adding files...
  > No files to remove.
  > Checking for uncommitted changes in the git working tree...
  > Found 1 changed files.
  > Fetching repo...
  { raw: '', remote: null, branches: [], tags: [] }
  > Checking-out branch...
  'data_2022-11-01' branch already existed.
  > Not pulling from repo.
  > Creating commit...
  {
    author: null,
    branch: 'main',
    commit: '954d4fb1a05f67eafd4b24e5d7a37d66d953',
    root: false,
    summary: { changes: 1, insertions: 0, deletions: 0 }
  }
  > No tag info provided.
  > Pushing commit to repo...
  Error: Error: Pushing to https://github.com/q121212/get_data
  error: src refspec data_2022-11-01
  
Outputs
Error: Error: Pushing to https://github.com/q121212/get_data
error: src refspec data_2022-11-01 does not match any
error: failed to push some refs to 'https://github.com/q121212/get_data'

my goal is to create a new branch and push files to it, or just push files if the new branch already exists

@EndBug
Copy link
Owner

EndBug commented Nov 1, 2022

What happens if you don't use the fetch-depth input for actions/checkout?

@q121212
Copy link
Author

q121212 commented Nov 1, 2022

with:

      - name: Clone repo
        uses: actions/checkout@v3
#        with:
#          fetch-depth: 0

in this step:

Run actions/checkout@v3
  with:
    repository: q121212/get_data_for_gcr_weekly_upd
    token: ***
    ssh-strict: true
    persist-credentials: true
    clean: true
    fetch-depth: 1
    lfs: false
    submodules: false
    set-safe-directory: true
  
Syncing repository: q121212/get_data_for_gcr_weekly_upd
Getting Git version info
  Working directory is '/home/runner/work/get_data_for_gcr_weekly_upd/get_data_for_gcr_weekly_upd'
  /usr/bin/git version
  git version 2.38.1
Temporarily overriding HOME='/home/runner/work/_temp/73300041-dd54-4344-bf4-faafc36b859d' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
/usr/bin/git config --global --add safe.directory /home/runner/work/get_data_for_gcr_weekly_upd/get_data_for_gcr_weekly_upd
Deleting the contents of '/home/runner/work/get_data_for_gcr_weekly_upd/get_data_for_gcr_weekly_upd'
Initializing the repository
Disabling automatic garbage collection
Setting up auth
Fetching the repository
Determining the checkout info
Checking out the ref
/usr/bin/git log -1 --format='%H'
'9e50e3af8ea29e2d05f94998adca747f9f41adc9'

but result of

      - name: Upload to new branch
        uses: EndBug/add-and-commit@v9
        with:
          message: test_message
          add: '*.parquet'
          new_branch: data_${{ steps.date.outputs.date }}
          push: true

is the same:

Run EndBug/add-and-commit@v9
  with:
    message: test_message
    add: *.parquet
    new_branch: data_2022-11-01
    push: true
    cwd: .
    default_author: github_actor
    fetch: --tags --force
    pathspec_error_handling: ignore
    github_token: ***
Running in /home/runner/work/get_data_for_gcr_weekly_upd/get_data_for_gcr_weekly_upd
Add input parsed as single string, running 1 git add command.
> Using 'q121212 <[email protected]>' as author.
> Using "test_message" as commit message.
Internal logs
  > Staging files...
  > Adding files...
  > No files to remove.
  > Checking for uncommitted changes in the git working tree...
  > Found 1 changed files.
  > Fetching repo...
  { raw: '', remote: null, branches: [], tags: [] }
  > Checking-out branch...
  'data_2022-11-01' branch already existed.
  > Not pulling from repo.
  > Creating commit...
  {
    author: null,
    branch: 'main',
    commit: 'f1697eb465797eea0a1deb8e718a15',
    root: false,
    summary: { changes: 1, insertions: 0, deletions: 0 }
  }
  > No tag info provided.
  > Pushing commit to repo...
  Error: Error: Pushing to https://github.com/q121212/get_data_for_gcr_weekly_upd
  error: src refspec data_2022-11-01 does not match any
  error: failed to push some refs to 'https://github.com/q121212/get_data_for_gcr_weekly_upd'
  
Outputs
Error: Error: Pushing to https://github.com/q121212/get_data_for_gcr_weekly_upd
error: src refspec data_src refspec data_2022-11-01 does not match any
error: failed to push some refs to 'https://github.com/q121212/get_data_for_gcr_weekly_upd'

@q121212
Copy link
Author

q121212 commented Nov 1, 2022

Looks strange 'data_2022-11-01' branch already existed.

@EndBug
Copy link
Owner

EndBug commented Nov 1, 2022

Could you enable debug logging, re-run the workflow, and post the new logs please?

@q121212
Copy link
Author

q121212 commented Nov 1, 2022

thank you, debug logging is very useful
re-run output:

##[debug]Evaluating condition for step: 'Upload to new branch'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Upload to new branch
##[debug]Loading inputs
##[debug]Evaluating: format('data_{0}', steps.date.outputs.date)
##[debug]Evaluating format:
##[debug]..Evaluating String:
##[debug]..=> 'data_{0}'
##[debug]..Evaluating Index:
##[debug]....Evaluating Index:
##[debug]......Evaluating Index:
##[debug]........Evaluating steps:
##[debug]........=> Object
##[debug]........Evaluating String:
##[debug]........=> 'date'
##[debug]......=> Object
##[debug]......Evaluating String:
##[debug]......=> 'outputs'
##[debug]....=> Object
##[debug]....Evaluating String:
##[debug]....=> 'date'
##[debug]..=> '[2:7:2)022-11-01'
##[debug]=> 'data_2022-11-01'
##[debug]Result: 'data_2022-11-01'
##[debug]Evaluating: github.token
##[debug]Evaluating Index:
##[debug]..Evaluating github:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'token'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Loading env
Run EndBug/add-and-commit@v9
  with:
    message: test_message
    add: *.parquet
    new_branch: data_2022-11-01
    push: true
    cwd: .
    default_author: github_actor
    fetch: --tags --force
    pathspec_error_handling: ignore
    github_token: ***
Running in /home/runner/work/get_data_for_gcr_weekly_upd/get_data_for_gcr_weekly_upd
##[debug]Input parsed as single string
  > Checking-out branch...
  'data_2022-11-01' branch already existed.
  > Not pulling from repo.
  > Creating commit...
  ##[debug]Git args parsed:
  ##[debug]  - Original: 
  ##[debug]  - Parsed: []
  {
    author: null,
    branch: 'main',
    commit: '03494707d09dd8456804ba7b9220b01809efe447',
    root: false,
    summary: { changes: 1, insertions: 0, deletions: 0 }
  }
  ##[debug]Setting output: committed=true
  ##[debug]Setting output: commit_sha=03494707d09dd8456804ba7b9220b01809efe447
  ##[debug]Setting output: commit_long_sha=03494707d09dd8456804ba7b9220b01809efe447
  > No tag info provided.
  > Pushing commit to repo...
  ##[debug]Running: git push origin data_2022-11-01 --set-upstream
  Error: Error: Pushing to https://github.com/q121212/get_data_for_gcr_weekly_upd
  error: src refspec data_2022-11-01 does not match any
  error: failed to push some refs to 'https://github.com/q121212/get_data_for_gcr_weekly_upd'
  
  ::endgroup::
::group::Outputs
Outputs
Error: Error: Pushing to https://github.com/q121212/get_data_for_gcr_weekly_upd
error: src refspec data_2022-11-01 does not match any
error: failed to push some refs to 'https://github.com/q121212/get_data_for_gcr_weekly_upd'

##[debug]Node Action run completed with exit code 1
##[debug]Set output committed = false
##[debug]Set output commit_long_sha = 
##[debug]Set output commit_sha = 
##[debug]Set output pushed = false
##[debug]Set output tagged = false
##[debug]Set output tag_pushed = false
##[debug]Set output committed = true
##[debug]Set output commit_sha = 03494707d09dd8456804ba7b9220b01809efe447
##[debug]Set output commit_long_sha = 03494707d09dd8456804ba7b9220b01809efe447
##[debug]Finishing: Upload to new branch

renaming date part of new branch from echo "::set-output name=date::$(date +'%Y-%m-%d')" to echo "::set-output name=date::$(date +'%Y_%m_%d')" (i.e. new branch name is data_2022_11-01 instead data_2022-11-01) allowed fix problem with creating new branch

##[debug]Evaluating condition for step: 'Upload to new branch'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Upload to new branch
##[debug]Loading inputs
##[debug]Evaluating: format('data_{0}', steps.date.outputs.date)
##[debug]Evaluating format:
##[debug]..Evaluating String:
##[debug]..=> 'data_{0}'
##[debug]..Evaluating Index:
##[debug]....Evaluating Index:
##[debug]......Evaluating Index:
##[debug]........Evaluating steps:
##[debug]........=> Object
##[debug]........Evaluating String:
##[debug]........=> 'date'
##[debug]......=> Object
##[debug]......Evaluating String:
##[debug]......=> 'outputs'
##[debug]....=> Object
##[debug]....Evaluating String:
##[debug]....=> 'date'
##[debug]..=> '2022_11_01'
##[debug]=> 'data_2022_11_01'
##[debug]Result: 'data_2022_11_01'
##[debug]Evaluating: github.token
##[debug]Evaluating Index:
##[debug]..Evaluating github:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'token'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Loading env
Run EndBug/add-and-commit@v9
  with:
    message: test_message
    add: *.parquet
    new_branch: data_2022_11_01
    push: true
    cwd: .
    default_author: github_actor
    fetch: --tags --force
    pathspec_error_handling: ignore
    github_token: ***
Running in /home/runner/work/get_data_for_gcr_weekly_upd/get_data_for_gcr_weekly_upd
##[debug]Input parsed as single string
  > Checking-out branch...
  Creating 'data_2022_11_01' branch.
  > Not pulling from repo.
  > Creating commit...
  ##[debug]Git args parsed:
  ##[debug]  - Original: 
  ##[debug]  - Parsed: []
  {
    author: null,
    branch: 'data_2022_11_01',
    commit: 'e5a98753485288a91bd07cf4bf4e534cc3e4618b',
    root: false,
    summary: { changes: 1, insertions: 0, deletions: 0 }
  }
  ##[debug]Setting output: committed=true
  ##[debug]Setting output: commit_sha=e5a98753485288a91bd07cf4bf4e534cc3e4618b
  ##[debug]Setting output: commit_long_sha=e5a98753485288a91bd07cf4bf4e534cc3e4618b
  > No tag info provided.
  > Pushing commit to repo...
  ##[debug]Running: git push origin data_2022_11_01 --set-upstream
  ##[debug]Setting output: pushed=true
  {
    pushed: [
      {
        deleted: false,
        tag: false,
        branch: true,
        new: true,
        alreadyUpdated: false,
        local: 'refs/heads/data_2022_11_01',
        remote: 'refs/heads/data_2022_11_01'
      }
    ],
    repo: 'https://github.com/q121212/get_data_for_gcr_weekly_upd',
    ref: { local: 'refs/remotes/origin/data_2022_11_01' },
    remoteMessages: It {
      all: [
        "Create a pull request for 'data_2022_11_01' on GitHub by visiting:",
        'https://github.com/q121212/get_data_for_gcr_weekly_upd/pull/new/data_2022_11_01'
      ],
      pullRequestUrl: 'https://github.com/q121212/get_data_for_gcr_weekly_upd/pull/new/data_2022_11_01'
    }
  }
  > No tags to push.
  ::endgroup::
> Task completed.
::group::Outputs
Outputs
  committed: true
  commit_long_sha: e5a98753485288a91bd07cf4bf4e534cc3e4618b
  commit_sha: e5a98753485288a91bd07cf4bf4e534cc3e4618b
  pushed: true
  tagged: false
  tag_pushed: false
  ::endgroup::
##[debug]Node Action run completed with exit code 0
##[debug]Set output committed = false
##[debug]Set output commit_long_sha = 
##[debug]Set output commit_sha = 
##[debug]Set output pushed = false
##[debug]Set output tagged = false
##[debug]Set output tag_pushed = false
##[debug]Set output committed = true
##[debug]Set output commit_sha = e5a98753485288a91bd07cf4bf4e534cc3e4618b
##[debug]Set output commit_long_sha = e5a98753485288a91bd07cf4bf4e534cc3e4618b
##[debug]Set output pushed = true
##[debug]Finishing: Upload to new branch

but the next run (when file was uploaded too new branch) leads to the next result:

##[debug]Evaluating condition for step: 'Upload to new branch'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Upload to new branch
##[debug]Loading inputs
##[debug]Evaluating: format('data_{0}', steps.date.outputs.date)
##[debug]Evaluating format:
##[debug]..Evaluating String:
##[debug]..=> 'data_{0}'
##[debug]..Evaluating Index:
##[debug]....Evaluating Index:
##[debug]......Evaluating Index:
##[debug]........Evaluating steps:
##[debug]........=> Object
##[debug]........Evaluating String:
##[debug]........=> 'date'
##[debug]......=> Object
##[debug]......Evaluating String:
##[debug]......=> 'outputs'
##[debug]....=> Object
##[debug]....Evaluating String:
##[debug]....=> 'date'
##[debug]..=> '2022_11_01'
##[debug]=> 'data_2022_11_01'
##[debug]Result: 'data_2022_11_01'
##[debug]Evaluating: github.token
##[debug]Evaluating Index:
##[debug]..Evaluating github:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'token'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Loading env
Run EndBug/add-and-commit@v9
  with:
    message: test_message
    add: *.parquet
    new_branch: data_2022_11_01
    push: true
    cwd: .
    default_author: github_actor
    fetch: --tags --force
    pathspec_error_handling: ignore
    github_token: ***
Running in /home/runner/work/get_data_for_gcr_weekly_upd/get_data_for_gcr_weekly_upd
##[debug]Input parsed as single string
Pushing to https://github.com/q121212/get_data_for_gcr_weekly_upd
error: failed to push some refs to 'https://github.com/q121212/get_data_for_gcr_weekly_upd'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

##[debug]Node Action run completed with exit code 1
##[debug]Set output committed = false
##[debug]Set output commit_long_sha = 
##[debug]Set output commit_sha = 
##[debug]Set output pushed = false
##[debug]Set output tagged = false
##[debug]Set output tag_pushed = false
##[debug]Set output committed = true
##[debug]Set output commit_sha = 9eb518cf405675315
##[debug]Set output commit_long_sha = 9eb518cf405678615
##[debug]Finishing: Upload to new branch```

@q121212
Copy link
Author

q121212 commented Nov 1, 2022

looks like I need select (checkout) a branch before push

@EndBug
Copy link
Owner

EndBug commented Nov 2, 2022

That depends on your use case, you can also play around with the fetch, push and pull commands to get the results you need.
I can't really help you with that, since it depends on how you're using your workflow

@q121212
Copy link
Author

q121212 commented Nov 2, 2022

Ok, thank you! In any case we have gone far from the original problem!

@EndBug
Copy link
Owner

EndBug commented Nov 2, 2022

I'm going to close this for now, feel free to reopen or create a new issue if needed.

@EndBug EndBug closed this as not planned Won't fix, can't repro, duplicate, stale Nov 2, 2022
@germa89
Copy link

germa89 commented Oct 30, 2023

Hello,

I'm having the same issue and I have already removed the fetch-deep, tried to increase the workflow permissions, etc.. and no luck until now.

Has anyone any suggestions?

Error: Error: Pushing to https://github.com/ansys/pymapdl
fatal: could not read Username for 'https://github.com/': No such device or address

The link to the workflow file is: https://github.com/ansys/pymapdl/actions/runs/6694925638/workflow?pr=2443
The run: https://github.com/ansys/pymapdl/actions/runs/6694925638/job/18189328032?pr=2443

The PR is: ansys/pymapdl#2443

In case there is no access to the yml file:
https://github.com/ansys/pymapdl/blob/main/.github/workflows/ci.yml

Details

##[debug]Current push option: 'true' (parsed as boolean)
::group::Internal logs
Internal logs
  > Staging files...
  > Adding files...
  ##[debug]Input parsed as single string
  ##[debug]Git args parsed:
  ##[debug]  - Original: ./tests/.image_cache/*.png
  ##[debug]  - Parsed: ["./tests/.image_cache/*.png"]
  > No files to remove.
  > Checking for uncommitted changes in the git working tree...
  > Found 8 changed files.
  ##[debug]Git args parsed:
  ##[debug]  - Original: 
  ##[debug]  - Parsed: []
  ##[debug]--allow-empty argument detected: false
  ##[debug]> Current git config
  ##[debug]{
  ##[debug]  "safe.directory": "/__w/pymapdl/pymapdl",
  ##[debug]  "core.repositoryformatversion": "0",
  ##[debug]  "core.filemode": "true",
  ##[debug]  "core.bare": "false",
  ##[debug]  "core.logallrefupdates": "true",
  ##[debug]  "remote.origin.url": "https://github.com/ansys/pymapdl",
  ##[debug]  "remote.origin.fetch": "+refs/heads/*:refs/remotes/origin/*",
  ##[debug]  "gc.auto": "0",
  ##[debug]  "branch.feat/create-minimal-file.remote": "origin",
  ##[debug]  "branch.feat/create-minimal-file.merge": "refs/heads/feat/create-minimal-file",
  ##[debug]  "user.email": "[email protected]",
  ##[debug]  "user.name": "germa89",
  ##[debug]  "author.email": "[email protected]",
  ##[debug]  "author.name": "germa89",
  ##[debug]  "committer.email": "[email protected]",
      { name: '0.43.3', tracking: '0.43.3' },
      { name: '0.43.4', tracking: '0.43.4' },
      { name: '0.44.0', tracking: '0.44.0' },
      { name: '0.44.1', tracking: '0.44.1' },
      { name: '0.44.10', tracking: '0.44.10' },
      { name: '0.44.11', tracking: '0.44.11' },
      { name: '0.44.12', tracking: '0.44.12' },
      { name: '0.44.13', tracking: '0.44.13' },
      { name: '0.44.14', tracking: '0.44.14' },
      { name: '0.44.15', tracking: '0.44.15' },
      ... 68 more items
    ],
    updated: [],
    deleted: []
  }
  > Not pulling from repo.
  > Creating commit...
  ##[debug]Git args parsed:
  ##[debug]  - Original: 
  ##[debug]  - Parsed: []
  {
    author: { email: '[email protected]', name: 'germa89' },
    branch: 'feat/create-minimal-file',
    commit: '2b9a5d9d068722105b833a098de35d63d8f30db5',
    root: false,
    summary: { changes: 8, insertions: 0, deletions: 0 }
  }
  ##[debug]Setting output: committed=true
  ##[debug]Setting output: commit_long_sha=2b9a5d9d068722105b833a098de35d63d8f30db5
  ##[debug]Setting output: commit_sha=2b9a5d9
  > No tag info provided.
  > Pushing commit to repo...
  ##[debug]Running: git push origin  --set-upstream
  Error: Error: Pushing to https://github.com/ansys/pymapdl

@EndBug
Copy link
Owner

EndBug commented Oct 31, 2023

@germa89 From a quick look, I see that you're using actions/checkout with persist-credentials: false
That will prevent the action from knowing how to authenticate to the GitHub server.

@germa89
Copy link

germa89 commented Oct 31, 2023

@germa89 From a quick look, I see that you're using actions/checkout with persist-credentials: false That will prevent the action from knowing how to authenticate to the GitHub server.

I added that attemping to fix dependabot not being able to use this action. I am removing it and I will see soon if dependabot keeps having issues or not.

Thank you a lot!

Linking: ansys/pymapdl#2443

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants