Tidak boleh menolak selepas menambah gudang jauh ke git
漂亮男人
漂亮男人 2017-05-02 09:28:02
0
2
515

Saya mempunyai Alibaba Cloud ECS (CentOS7), dan saya perlu meletakkan projek padanya, tetapi saya tidak mahu melalui github Saya mahu menambah gudang jauh terus ke gudang git tempatan dan menolaknya terus ke ECS.
Mula-mula buat direktori projek dalam ECS dan mulakan gudang: $ git init
Tambah gudang jauh ke gudang tempatan:

$ git remote add ECSmaster ssh://username@IP/~/path/.git

Selepas menambahnya, ia tidak boleh ditolak Mesej ralat adalah seperti berikut:

$ git push -u ECSmaster master
username@IP's password:
Counting objects: 180, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (75/75), done.
Writing objects: 100% (180/180), 32.15 KiB | 0 bytes/s, done.
Total 180 (delta 104), reused 180 (delta 104)
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error:
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some
remote: error: other way.
remote: error:
remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To ssh://username@IP/~/cloudNote/.git
 ! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'ssh://username@IP/~/cloudNote/.git'


$ git remote show ECSmaster
username@IP's password:
* remote ECSmaster
  Fetch URL: ssh://username@IP/~/cloudNote/.git
  Push  URL: ssh://username@IP/~/cloudNote/.git
  HEAD branch: (unknown)

Operasi di atas merujuk kepada artikel ini: http://www.cnblogs.com/xiaoya901109/archive/2012/08/03/2620664.html

漂亮男人
漂亮男人

membalas semua(2)
过去多啦不再A梦

Parameter --bare harus ditambah apabila memulakan gudang pada pelayan
git init --bare

为情所困

Masukkan yang berikut pada pelayan jauh:
git config 'receive.denyCurrentBranch' warn

Ralat ini disebabkan oleh ukuran perlindungan git master->master untuk mengelakkan salah operasi

Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan