Hi,
Thank you so much for your reply.
The information is as follows:
# ls .git
branches config description HEAD hooks info objects refs
#
# git commit -m "Initial commit"
Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'root@Docker.(none)')
#
# git log
fatal: your current branch 'master' does not have any commits yet
$ git init
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: git branch -m <name>
Initialized empty Git repository in /home/jason/Downloads/repo/.git/
$ git remote add origin git@172.20.2.57:hack3rcon/test.git
$ git add *
fatal: pathspec '*' did not match any files
$ git add .
$ git commit -m "Initial commit"
On branch master
Initial commit
nothing to commit (create/copy files and use "git add" to track)
$ git push -u origin master
error: src refspec master does not match any
error: failed to push some refs to '172.20.2.57:hack3rcon/test.git'
Thank you so much.
So, I must run those commands on the GitLab server and the directory that codes are there. On the GitLab server, they are other projects:
Ah I think I see what’s going on here. It looks like you expect git remote add origin git@172.20.2.57:hack3rcon/test.git to pull down the repository for you. It will not. It will only tell git where to push/pull from when you tell it to.
In order to get a local copy of the files, what you’d normally do is
git clone git@172.20.2.57:hack3rcon/test.git
This will create a test directory in your current directory with all the files from gitlab and configured to use gitlab to push to / pull from.
The error indicates that there is no branch named “master” on the local computer. This could be because the commit was made without any changes, or the branch was deleted. To resolve the issue, you can try the following:
Make sure your repository has commits. Run git log to view your commit history.
Check if there is a branch named “master”. Run git branch to see a list of branches.
If your repository does not have any commits or a “master” branch, create a new branch and commit.